    :root {
        --mago-red: #E30613;
        /* Cor oficial aproximada */
        --mago-dark: #b3000b;
    }

    html, body {
        height: 100%;
        margin: 0;
        padding: 0;
    }

    body {
        background-color: #f8f9fa;
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        overflow-x: hidden;
        display: flex;
        flex-direction: column;
    }

    /* Limita o tamanho do app na versão web para simular a proporção mobile e otimizar o vídeo */
    .container {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        padding-bottom: 0 !important;
        min-height: 0;
    }



    /* Header Supermago */
    .header-brand {
        background-color: #FFFFFF;
        color: #333;
        padding: 0;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); /* Sombra mais polida e visível */
        position: relative;
        z-index: 20; /* Garante que a sombra fique sobre o card do produto */
    }

    .header-brand img {
        width: 32%;
        /* Reduced from 50% */
        max-width: 128px;
        /* Reduced from 200px */
        height: auto;
    }



    /* Card Produto */
    .product-card {
        background: white;
        border: 1px solid rgba(0, 0, 0, 0.04);
        border-radius: 16px;
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.06), 0 5px 10px -5px rgba(0, 0, 0, 0.02);
        padding: 12px;
        margin-top: 8px;
        position: relative;
        z-index: 10;
        display: flex;
        align-items: center;
        gap: 15px;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
        min-height: 135px;
        box-sizing: border-box;
    }

    .product-img-wrap {
        flex-shrink: 0;
    }

    .product-img {
        width: auto;
        max-width: 220px;
        height: auto;
        max-height: 200px;
        object-fit: contain;
        border-radius: 8px;
        display: block;
        margin: 0 auto;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.05));
    }

    .product-info h3 {
        margin-bottom: 2px !important;
        font-size: 0.75rem;
        /* Reduced from 0.8rem */
        line-height: 1.2;
        color: #2d3748;
        font-weight: 700;
        letter-spacing: -0.02em;
    }

    .product-info .price-inline {
        margin-top: 2px !important;
    }

    .price-inline {
        display: flex;
        align-items: baseline;
        gap: 6px;
        flex-wrap: wrap;
    }

    .price-tag {
        color: var(--mago-red);
        font-size: 1.25rem;
        font-weight: 800;
        line-height: 1;
        letter-spacing: -0.03em;
    }

    .detail-row {
        display: flex;
        gap: 5px;
        border-bottom: 1px dashed #edf2f7;
        padding: 2px 0;
        /* Reduced from 3px */
        align-items: baseline;
    }

    .detail-row small {
        font-size: 0.65rem;
    }

    .detail-row strong {
        color: #2d3748;
        /* Darker to match price/title */
        font-weight: 800;
        /* Bolder to match price tag weight */
        font-size: 0.7rem;
        /* Reduced from 0.75rem */
        /* Slightly larger */
    }

    /* Celulares estreitos ou baixos (inclui 375×667) — regras compactas */
    @media (max-width: 390px), (max-width: 576px) and (max-height: 700px) {
        .product-card {
            min-height: unset !important;
            padding: 4px !important;
            gap: 8px !important;
        }
        #descricaoProduto,
        #loteValidade {
            display: none !important;
        }
    }

    @media (max-width: 576px) {

        .header-brand img {
            width: auto;
            max-width: 70%;
        }

        .product-card {
            flex-direction: row;
            /* Side by side */
            align-items: center;
            text-align: left;
            /* Left align text */
            margin-left: 0;
            margin-right: 0;
            margin-top: 8px;
            width: 100%;
            padding: 5px;
            /* Reduced padding */
            gap: 10px;
            /* Smaller gap */
            min-height: unset; /* Remove altura mínima forçada — o conteúdo dita a altura */
        }

        .product-img {
            width: auto;
            max-width: 78px;
            max-height: 78px;
            /* Imagem levemente menor para eliminar espaço extra */
            margin-bottom: 0;
        }

        .product-img-wrap {
            flex: 0 0 78px !important;
            max-width: 78px !important;
        }

        .product-info h3,
        #nomeProduto {
            font-size: 0.95rem !important; /* Aumentado de 0.7rem */
            line-height: 1.2 !important;
            margin-bottom: 4px !important;
            min-height: unset !important; /* Remove o min-height inline que cria espaço vazio */
            word-wrap: break-word;
            white-space: normal;
        }

        #descricaoProduto {
            font-size: 0.78rem !important; /* Aumentado de 0.7rem */
            line-height: 1.35 !important;
        }

        .price-inline {
            justify-content: flex-start;
            /* Left align price */
            margin-top: 2px !important;
        }

        .price-tag {
            font-size: 1.1rem;
        }

        /* Chat fixes for mobile */
        /* Chat fixes for mobile */
        .chat-body {
            padding: 5px !important;
            /* Force tight padding */
        }

        .chat-header {
            font-size: 0.8rem;
            padding: 6px 8px;
            white-space: normal;
            /* Allow text to wrap */
        }

        .msg {
            font-size: 0.65rem;
            padding: 3px 5px;
            max-width: 95%;
        }

        .promo-subtext {
            font-size: 0.5rem;
            margin-bottom: 1px;
            /* Reduced from 4px */
        }

        .promo-box {
            margin-left: 0;
            margin-right: 0;
        }
    }

    /* Modo compacto — reforça os tamanhos após o bloco mobile de 576px */
    @media (max-width: 390px), (max-width: 576px) and (max-height: 700px) {
        .product-img-wrap {
            flex: 0 0 55px !important;
            max-width: 55px !important;
        }
        .product-img {
            max-width: 50px !important;
            max-height: 50px !important;
        }
        .product-info h3,
        #nomeProduto {
            font-size: 0.82rem !important; /* Ligeiramente menor que o mobile padrão */
            line-height: 1.15 !important;
            min-height: unset !important;
        }
    }

    /* Card Promoção - Modern Design */
    .promo-box {
        background: #fffdef;
        border: 2px dashed #fbc02d;
        border-radius: 16px;
        padding: 10px 10px 4px 10px;
        /* Reduced bottom padding */
        margin-top: 10px;
        position: relative;
        box-shadow: 0 0 20px rgba(251, 192, 45, 0.15);
        text-align: center;
        animation: attract-pulse 2s infinite ease-in-out;
    }

    @keyframes attract-pulse {
        0% {
            border-color: #fbc02d;
            box-shadow: 0 0 10px rgba(251, 192, 45, 0.2);
            transform: scale(1);
        }

        50% {
            border-color: #ffca28;
            box-shadow: 0 0 25px rgba(251, 192, 45, 0.6);
            transform: scale(1.02);
        }

        100% {
            border-color: #fbc02d;
            box-shadow: 0 0 10px rgba(251, 192, 45, 0.2);
            transform: scale(1);
        }
    }

    .promo-header {
        font-size: 0.9rem;
        /* Reduced from 0.95rem */
        font-weight: 800;
        color: #b38f00;
        text-transform: uppercase;
        margin-bottom: 2px;
        letter-spacing: 0.02em;
    }

    .promo-subtext {
        font-size: 0.7rem;
        color: #856404;
        font-weight: 600;
        margin-bottom: 1px;
        /* Reduced margin */
    }

    .promo-produtos {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        justify-content: center;
    }

    .promo-produto-item {
        background: #ffffff;
        border-radius: 12px;
        padding: 5px;
        flex: 1 1 calc(50% - 10px);
        min-width: 130px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
        border: 1px solid rgba(0, 0, 0, 0.02);
        display: flex;
        align-items: center;
        gap: 5px;
        transition: transform 0.2s;
    }

    .promo-produto-item:hover {
        transform: translateY(-2px);
    }

    .promo-produto-img {
        width: 45px;
        height: 45px;
        object-fit: contain;
        border-radius: 6px;
    }

    .promo-produto-desc {
        font-size: 0.8rem;
        color: #5a4a08;
        font-weight: 700;
        line-height: 1.1;
        text-align: left;
    }

    .promo-observacao {
        margin-top: 1px;
        /* Reduced margin */
        margin-bottom: 0;
        /* Removing default p margin */
        font-size: 0.75rem;
        color: #856404;
        font-weight: 600;
        opacity: 0.9;
    }

    /* Chat Maguinho */
    .chat-container {
        margin-top: 5px; /* Reduzido de 15px para encostar mais */
        background: white;
        border-radius: 12px 12px 0 0;
        overflow: hidden;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        position: relative;
    }

    .chat-header {
        background: var(--mago-red);
        color: white;
        padding: 10px 12px;
        font-weight: 700;
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 16px;
    }

    .chat-header-actions { display: flex; align-items: center; gap: 14px; flex-shrink: 0; margin: -8px 0; }
    .chat-ajuda-whatsapp {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        min-height: 40px;
        padding: 0 4px;
        color: #fff;
        font-size: .82rem;
        font-weight: 500;
        text-decoration: none;
        border-radius: 4px;
    }
    .chat-ajuda-whatsapp i { font-size: 1.1rem; }
    .chat-ajuda-whatsapp:hover { color: #fff; text-decoration: underline; }
    .chat-ajuda-whatsapp:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

    .chat-body .chat-retry {
        background-color: #fff;
        color: #c6000d;
        border: 2px solid #c6000d;
        border-radius: 12px;
        min-height: 44px;
        padding: 8px 16px;
        font-size: .95rem;
        font-weight: 600;
        line-height: 1.4;
        opacity: 1;
    }
    .chat-body .chat-retry:hover,
    .chat-body .chat-retry:active { background-color: #fff0f1; color: #a6000b; border-color: #a6000b; }
    .chat-body .chat-retry:focus-visible { outline: 3px solid #c6000d; outline-offset: 3px; }
    .chat-body .chat-retry:disabled { background-color: #f5f5f5; color: #6b6b6b; border-color: #aaa; opacity: 1; }

    .chat-body {
        height: 100%;
        /* Fill wrapper */
        overflow-y: auto;
        padding: 15px;
        background-color: transparent;
        /* Transparent for video */
        position: relative;
        z-index: 1;
        display: flex;
        flex-direction: column;
    }

    /* O balão de carregamento fica sempre no rodapé (empurrado para baixo) e alinhado à direita */
    .loading-msg {
        margin-top: auto !important;
        margin-left: auto !important;
        align-self: flex-end !important;
        float: right !important;
        clear: both !important;
        text-align: right;
    }

    .loading-msg .msg-bot-bubble {
        border-bottom-left-radius: 16px;
        border-bottom-right-radius: 4px;
        text-align: left;
    }

    .container {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        padding-bottom: 0 !important;
        min-height: 0;
    }

    /* Largura de Desktop e Tablet — aumentada para reduzir margens em 1024×768 */
    @media (min-width: 768px) {
        .container {
            max-width: 980px !important;
        }
    }

    .chat-container {
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        background: #f8f9fa;
        min-height: 0;
    }

    /* No mobile, o card do produto encosta nas bordas para preencher tudo */
    @media (max-width: 576px) {
        .container {
            padding-left: 0 !important;
            padding-right: 0 !important;
        }
        .product-card {
            border-radius: 0 !important;
            border-left: none !important;
            border-right: none !important;
            margin-top: 8px !important; /* Distanciamento uniforme */
            border-top: 1px solid rgba(0,0,0,0.06) !important;
            border-bottom: 1px solid rgba(0,0,0,0.06) !important;
            box-shadow: 0 4px 15px rgba(0,0,0,0.03) !important; /* Efeito 2D polido */
        }
        .chat-container {
            border-radius: 0 !important;
            border-left: none !important;
            border-right: none !important;
            border-top: 1px solid rgba(0,0,0,0.06) !important;
        }
    }

    /* Ajustes do card do produto no Desktop e Tablet (ex: 768px, 1024px, 1180px+) */
    @media (min-width: 768px) {
        .product-card {
            justify-content: flex-start !important;
            padding: 8px 16px !important;
            min-height: unset !important; /* remove altura mínima forçada */
            gap: 15px !important;
        }
        .product-img-wrap {
            flex: 0 0 90px !important; /* Compacto em tablet/desktop médio */
            max-width: 90px !important;
        }
        .product-img {
            max-width: 85px;
            max-height: 85px;
        }
        .product-info {
            flex: 1 1 auto !important; /* Preenche a largura eliminando as sobras/margens laterais vazias */
            max-width: 100% !important;
        }
        .product-info h3,
        #nomeProduto {
            font-size: 1.25rem !important;
            line-height: 1.3 !important;
            min-height: unset !important;
            margin-bottom: 6px !important;
        }
        #descricaoProduto {
            font-size: 0.95rem !important;
            line-height: 1.4 !important;
        }
        #loteValidade {
            font-size: 0.82rem !important;
            margin-top: 6px !important;
        }
    }

    /* No desktop maior a imagem é ligeiramente maior mas ainda compacta */
    @media (min-width: 1200px) {
        .product-img-wrap {
            flex: 0 0 140px !important;
            max-width: 140px !important;
        }
        .product-img {
            max-width: 130px;
            max-height: 130px;
        }
    }


    #experienciaContainer {
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        overflow: hidden;
        min-height: 0;
    }

    .chat-video-wrapper {
        position: relative;
        flex-grow: 1;
        height: 0; /* Cresce via flex-grow para preencher o resto da tela */
        min-height: 0; /* Vital para permitir o scroll interno em flexbox */
        background-color: #f8f9fa;
        /* Fallback color */
        overflow: hidden;
    }

    @media (min-width: 992px) {
        .chat-video-wrapper {
            /* Mínimo suficiente para a personagem aparecer sem cortar o input em tablets deitados */
            min-height: 200px;
        }
    }

    .chat-bg-video {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: right center;
        /* Alinhado à direita para não cortar o personagem */
        z-index: 0;
        pointer-events: none;
    }

    .chat-bg-image {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: right center;
        z-index: 0;
        pointer-events: none;
    }

    .msg {
        margin-bottom: 4px;
        padding: 10px 14px;
        border-radius: 16px;
        max-width: 65%;
        font-size: 0.8rem;
        line-height: 1.3;
        transition: opacity 0.4s ease;
    }

    /* Estado de carregamento do chat (exceto o próprio balão de loading) */
    .chat-loading .msg:not(.loading-msg) {
        opacity: 0.25;
        pointer-events: none; /* Evita interações acidentais nos balões esmaecidos */
    }

    .msg-bot {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        max-width: 90% !important;
        float: left;
        clear: both;
        align-self: flex-start;
    }

    .msg-bot-bubble {
        background: rgba(255, 255, 255, 0.95);
        border-radius: 16px;
        border-bottom-left-radius: 4px;
        color: #333;
        border: 1px solid rgba(0, 0, 0, 0.04);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
        padding: 10px 14px;
        display: inline-block;
        margin-bottom: 6px;
    }

    .msg-bot-space {
        margin-top: 5px;
        /* Reduced from 60px */
    }

    .msg-user {
        background: #007AFF;
        /* Azul estilo iOS / Mensagens */
        color: white;
        border-bottom-left-radius: 4px;
        float: left;
        clear: both;
        align-self: flex-start;
    }

    .chat-options {
        max-width: 100%;
        margin-top: 6px;
    }
    .chat-options-multi { width: 560px; }

    .chat-choice {
        border: 2px solid #E30613;
        border-radius: 12px;
        background: #fff;
        color: #E30613;
        font: inherit;
        font-weight: 600;
        font-size: 0.8rem;
        padding: 6px 10px;
        min-height: 38px;
        text-align: left;
        overflow-wrap: anywhere;
        cursor: pointer;
    }

    .chat-choice:hover:not(:disabled) { background: #fff1f2; }
    .chat-choice:focus-visible { outline: 3px solid #007AFF; outline-offset: 2px; }
    .chat-choice.is-selected { background: #007AFF; border-color: #007AFF; color: #fff; }
    .chat-choice.is-selected:hover:not(:disabled) { background: #007AFF; }
    .chat-choice:disabled { cursor: default; }
    .chat-quick-option { max-width: 100%; }
    .chat-multiselect { margin-bottom: 8px; min-width: 0; }
    .chat-multiselect-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }
    .chat-multiselect-option { display: flex; justify-content: space-between; align-items: center; gap: 4px; min-width: 0; }
    .chat-choice-check { flex: 0 0 14px; }
    .chat-multiselect-continue {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        min-width: 180px;
        max-width: 100%;
        min-height: 44px;
        margin: 10px 1px 4px;
        padding: 9px 16px;
        background: #E30613;
        color: #fff;
        border: 2px solid #fff;
        font-weight: 700;
        box-shadow: 0 0 0 1px #E30613, 0 3px 8px rgba(179, 0, 11, 0.25);
    }
    .chat-multiselect-continue:hover:not(:disabled) { background: #B3000B; }
    .chat-multiselect-continue:disabled {
        background: #e9ecef;
        color: #6c757d;
        border-color: #d1d5db;
        box-shadow: none;
        opacity: 1;
    }
    @media (max-width: 359.98px) {
        .chat-multiselect-grid { grid-template-columns: minmax(0, 1fr); }
    }

    .preco-produto-oferta { display: inline-flex; flex-direction: column; gap: 2px; max-width: 100%; }
    .preco-produto-anterior { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 5px; font-size: 0.68rem; line-height: 1.25; color: #6c757d; font-weight: 400; }
    .preco-produto-anterior s { white-space: nowrap; }
    .preco-produto-selo { color: #B3000B; background: #fff1f2; border-radius: 4px; padding: 1px 4px; font-weight: 600; text-decoration: none; }
    .preco-produto-oferta strong { color: #E30613; font-weight: 700; line-height: 1.25; }
    .sugestao-preco { font-weight: 700; font-size: 0.95rem; color: #E30613; }

    @keyframes pulse-border-green {
        0% { box-shadow: 0 0 0 0 rgba(23, 107, 74, 0.4); }
        70% { box-shadow: 0 0 0 8px rgba(23, 107, 74, 0); }
        100% { box-shadow: 0 0 0 0 rgba(23, 107, 74, 0); }
    }

    .btn.chat-adicionar-carrinho {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        max-width: 100%;
        background-color: #F0F7F3;
        animation: pulse-border-green 2s infinite;
        border: 1px solid #176B4A;
        color: #176B4A;
        border-radius: 20px;
        font-weight: 600;
        padding: 9px 20px;
        font-size: 0.95rem;
        transition: background-color 0.2s ease, border-color 0.2s ease;
    }
    .btn.chat-adicionar-carrinho svg {
        flex-shrink: 0;
    }
    .btn.chat-adicionar-carrinho:hover,
    .btn.chat-adicionar-carrinho:active {
        background-color: #E1EFE7;
        border-color: #115238;
        color: #115238;
    }
    .btn.chat-adicionar-carrinho:focus-visible {
        outline: 3px solid #176B4A;
        outline-offset: 3px;
    }

    .clearfix::after {
        content: "";
        display: table;
        clear: both;
    }

    @keyframes pulse {
        0% {
            transform: scale(1);
        }

        50% {
            transform: scale(1.02);
        }

        100% {
            transform: scale(1);
        }
    }

    /* Estilo para mensagem m�gica (Produto n�o encontrado) */
    .magic-text {
        color: #4a148c !important;
        /* Roxo M�gico Profundo */
        font-family: 'Georgia', 'Times New Roman', serif;
        /* Fonte estilo livro antigo/grim�rio */
        font-style: normal;
        font-size: 1.1rem !important;
        text-shadow: 1px 1px 2px rgba(74, 20, 140, 0.1);
        background: linear-gradient(45deg, #4a148c, #7b1fa2);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        line-height: 1.4 !important;
    }

    .text-decoration-none {
        text-decoration: none !important;
    }



    /* Substituição da cor vermelha padrão do Bootstrap para ficar na identidade do Hirota */
    .btn-danger {
        background-color: var(--mago-red) !important;
        border-color: var(--mago-red) !important;
    }
    
    .btn-danger:hover {
        background-color: var(--mago-dark) !important;
        border-color: var(--mago-dark) !important;
    }

    /* Card de Produto Não Encontrado */
    .not-found-card {
        background-color: #FFF8EE !important;
        border: 1px solid rgba(230, 218, 200, 0.4) !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        text-align: left !important;
        padding: 15px !important;
        gap: 15px !important;
    }
    .not-found-icon {
        font-size: 40px;
        flex-shrink: 0;
        color: #d1c4b4;
    }
    .not-found-content h3 {
        margin: 0 0 5px 0 !important;
        font-size: 20px !important;
        font-weight: 700 !important;
        color: var(--mago-red) !important;
        line-height: 1.2 !important;
    }
    .not-found-content p {
        margin: 0 !important;
        font-size: 0.85rem !important;
        color: #495057 !important;
        line-height: 1.3 !important;
    }

    /* Botão de envio do chat maior e mais confortável */
    .chat-container .input-group .btn {
        padding-left: 1.3rem;
        padding-right: 1.3rem;
        font-size: 1.15rem;
        transition: all 0.2s ease;
    }

    .chat-container .input-group .btn:active {
        transform: scale(0.95);
    }

    /* Elementos ocultáveis com animação */
    #linkProdutoPrincipal,
    #cpfContainer {
        transition: max-height 0.4s cubic-bezier(0.25, 1, 0.5, 1), min-height 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease-out, margin 0.4s cubic-bezier(0.25, 1, 0.5, 1), padding 0.4s cubic-bezier(0.25, 1, 0.5, 1);
        max-height: 500px;
        opacity: 1;
        overflow: hidden;
        margin-top: 8px;
    }

    /* O cadastro pode crescer além do cartão inicial de identificação. */
    #cpfContainer {
        max-height: none;
        flex-shrink: 0;
        overflow: visible;
        transition: opacity 0.3s ease-out, margin 0.4s ease, padding 0.4s ease;
    }

    /* --- OCULTAR INFORMAÇÕES DO PRODUTO (ABAS ADICIONAR E CARRINHO) --- */
    body.hide-product-info #linkProdutoPrincipal,
    body.hide-product-info #cpfContainer {
        overflow: hidden;
        max-height: 0 !important;
        min-height: 0 !important;
        opacity: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        border: none !important;
        pointer-events: none;
    }

    /* --- CHAT EXPANDIDO (OVERLAY) --- */
    body.chat-expanded {
        overflow: hidden !important; /* Previne rolagem do fundo da página */
    }

    body.chat-has-expanded #btnRestaurarChat {
        display: block !important;
    }

    /* O container do chat se torna um overlay modal que cobre a tela */
    .chat-container.is-expanded {
        position: fixed !important;
        top: var(--chat-top, 70px) !important; /* Calculado dinamicamente para respeitar o logo */
        left: 0 !important;
        right: 0 !important;
        bottom: calc(65px + env(safe-area-inset-bottom, 0px)) !important;
        margin: 0 auto !important; /* Centraliza na tela */
        width: 100% !important; /* Ocupa 100% até o limite do max-width */
        z-index: 1050 !important;
        background: #f8f9fa !important; /* Fundo sólido */
        display: flex !important;
        flex-direction: column !important;
        animation: chatFadeIn 0.3s ease-out forwards;
    }

    .chat-container.is-collapsing {
        position: fixed !important;
        top: var(--chat-top, 70px) !important;
        left: 0 !important;
        right: 0 !important;
        bottom: calc(65px + env(safe-area-inset-bottom, 0px)) !important;
        margin: 0 auto !important; /* Centraliza na tela */
        width: 100% !important;
        z-index: 1050 !important;
        background: #f8f9fa !important;
        display: flex !important;
        flex-direction: column !important;
        animation: chatFadeOut 0.25s ease-in forwards;
    }

    /* Regra de largura máxima (max-width) para manter as margens no Desktop (descontando o padding de 24px do container para alinhar com a bottom-nav) */
    @media (min-width: 576px) {
        .chat-container.is-expanded, .chat-container.is-collapsing { max-width: 516px !important; }
    }
    @media (min-width: 768px) {
        .chat-container.is-expanded, .chat-container.is-collapsing { max-width: 956px !important; /* 980px - 24px */ }
    }

    @keyframes chatFadeIn {
        0% { opacity: 0; }
        100% { opacity: 1; }
    }

    @keyframes chatFadeOut {
        0% { opacity: 1; }
        100% { opacity: 0; }
    }

    .chat-container.is-expanded .chat-video-wrapper,
    .chat-container.is-collapsing .chat-video-wrapper {
        flex-grow: 1 !important;
        height: auto !important;
    }

    .chat-container.is-expanded .chat-body,
    .chat-container.is-collapsing .chat-body {
        height: 100%;
        overflow-y: auto;
    }

/* --- BOTTOM NAV BAR --- */
body {
    /* Espaço para a barra fixa no final da página */
    padding-bottom: calc(65px + env(safe-area-inset-bottom, 0px));
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    background: #fff;
    border-top: 1px solid #eaeaea;
    display: flex;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    height: calc(65px + env(safe-area-inset-bottom, 0px));
}

.nav-item {
    flex: 1;
    background: none;
    border: none;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 0.75rem;
    font-weight: 600;
    transition: color 0.2s;
}

.nav-item.active {
    color: #E30613;
}

.nav-icon {
    font-size: 1.3rem;
    margin-bottom: 2px;
}

#navAdicionar .nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #B9E4C9;
    color: #145C3E;
    font-size: 1.1rem;
    transition: background-color 0.2s, color 0.2s;
}

#navAdicionar.active .nav-icon {
    background: #FFF0F1;
    color: #E30613;
}

#navAdicionar .nav-label {
    max-width: 100%;
    padding: 0 3px;
    line-height: 1.2;
    text-align: center;
}

.kimi-avatar {
    filter: grayscale(100%) opacity(0.5);
    transition: filter 0.2s;
    font-size: 1.35rem;
    line-height: 1;
}

.nav-item.active .kimi-avatar {
    filter: none;
}

.cart-badge {
    position: absolute;
    top: -6px;
    right: -12px;
    background: #E30613;
    color: #fff;
    border-radius: 10px;
    padding: 2px 5px;
    font-size: 0.6rem;
    font-weight: bold;
    font-family: sans-serif;
}

/* Ocultar barra se teclado virtual subir (redução de altura extrema) */
body.keyboard-open .bottom-nav {
    display: none !important;
}

/* Garante que a barra inferior tenha EXATAMENTE a mesma largura do container (subtraindo os 24px de padding laterais do bootstrap) */
@media (min-width: 576px) {
    .bottom-nav {
        width: 516px; /* 540px - 24px */
    }
}
@media (min-width: 768px) {
    .bottom-nav {
        width: 956px; /* 980px - 24px */
    }
}

/* Grid e Cards na Aba Adicionar */
.adicionar-categoria { margin-bottom: 28px; min-width: 0; }
.adicionar-categoria-titulo {
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.35;
    color: #B3000B;
    background: #fff1f2;
    margin: 0 0 12px;
    padding: 11px 12px;
    border: 1px solid #ffd8dc;
    border-left: 5px solid #E30613;
    border-radius: 8px;
    overflow-wrap: anywhere;
}
.adicionar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 119px), 1fr));
    gap: 9px;
    align-items: stretch;
}
@media (min-width: 576px) {
    .adicionar-grid { gap: 10px; }
}

.adicionar-card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #eaeaea;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
    position: relative;
    padding-bottom: 10px;
    height: 100%; /* Força mesma altura entre colunas da linha */
}

@keyframes destaqueAdicaoVerde {
    0% { transform: scale(1); box-shadow: 0 2px 4px rgba(0,0,0,0.03); border-color: #eaeaea; }
    50% { transform: scale(1.02); box-shadow: 0 8px 24px rgba(40, 167, 69, 0.25); border-color: rgba(40, 167, 69, 0.6); z-index: 10; }
    100% { transform: scale(1); box-shadow: 0 2px 4px rgba(0,0,0,0.03); border-color: #eaeaea; }
}

@keyframes destaqueAdicaoVermelha {
    0% { transform: scale(1); box-shadow: 0 2px 4px rgba(0,0,0,0.03); border-color: #eaeaea; }
    50% { transform: scale(1.02); box-shadow: 0 8px 24px rgba(227, 6, 19, 0.25); border-color: rgba(227, 6, 19, 0.6); z-index: 10; }
    100% { transform: scale(1); box-shadow: 0 2px 4px rgba(0,0,0,0.03); border-color: #eaeaea; }
}

.animacao-adicao-verde {
    animation: destaqueAdicaoVerde 0.8s ease-out;
}

.animacao-adicao-vermelha {
    animation: destaqueAdicaoVermelha 0.8s ease-out;
}

.adicionar-card.bloqueado {
    opacity: 0.6;
}

.adicionar-card-img-container {
    position: relative;
    width: 100%;
    padding-top: 100%; /* Ratio 1:1 */
    background: #f8f9fa;
    border-bottom: 1px solid #f0f0f0;
}

.adicionar-card-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}

/* Controle sobreposto na imagem (estilo Amazon) */
.adicionar-card-controls {
    position: absolute;
    bottom: -15px;
    right: 10px;
    z-index: 2;
    display: flex;
    justify-content: flex-end;
}

.qty-btn-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: #E30613; /* Vermelho Hirota */
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 2px 6px rgba(227, 6, 19, 0.4);
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

.qty-btn-circle:active:not(:disabled) {
    transform: scale(0.95);
}

.qty-pill {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1.5px solid #E30613;
    border-radius: 20px;
    height: 34px;
    padding: 0 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.qty-pill-btn {
    background: none;
    border: none;
    color: #444; /* Cinza escuro/neutro */
    font-size: 0.9rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.qty-pill-btn:active:not(:disabled) {
    opacity: 0.5;
}

.qty-pill-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
}

.qty-pill-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a1a1a;
    min-width: 24px;
    text-align: center;
}

.adicionar-card-body {
    padding: 20px 10px 5px 10px; /* Padding top maior para compensar a pílula sobreposta */
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.adicionar-card-title {
    font-size: 0.85rem;
    color: #1a1a1a;
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}

.adicionar-card-price {
    font-size: 1.05rem;
    color: #1a1a1a;
    font-weight: 700;
}

.adicionar-card-badge {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: 5px;
    display: inline-block;
    align-self: flex-start;
}

/* Compact cards: 170px -> 119px target width; preserve readable text and touch controls. */
.adicionar-card { min-width: 0; padding-bottom: 7px; border-radius: 6px; }
.adicionar-card-img { padding: 7px; }
@media (max-width: 575.98px) {
    .adicionar-card-img-container { padding-top: 70%; }
}
.adicionar-card-body { padding: 22px 7px 4px; min-width: 0; }
.adicionar-card-title {
    font-size: 0.8rem;
    margin-bottom: 6px;
    display: block;
    overflow: visible;
    overflow-wrap: anywhere;
    -webkit-line-clamp: unset;
}
.adicionar-card-price { font-size: 0.95rem; overflow-wrap: anywhere; }
.adicionar-card-controls { right: 5px; bottom: -18px; max-width: calc(100% - 10px); }
.adicionar-card .qty-btn-circle { width: 36px; height: 36px; }
.adicionar-card .qty-pill { height: 36px; padding: 0 2px; max-width: 100%; }
.adicionar-card .qty-pill-btn { width: 32px; height: 32px; flex-shrink: 0; }
.adicionar-card .qty-pill-value { min-width: 20px; font-size: 0.85rem; }
.adicionar-card-badge { max-width: 100%; overflow-wrap: anywhere; }

/* --- View Carrinho (Lista Estilo Amazon) --- */
.carrinho-card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #eaeaea;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    padding: 12px;
    margin-bottom: 12px;
    display: flex;
    gap: 15px;
}

.carrinho-card-img-container {
    width: 90px;
    height: 90px;
    min-width: 90px;
    position: relative;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .carrinho-card-img-container {
        width: 100px;
        height: 100px;
        min-width: 100px;
    }
}

.carrinho-card-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.carrinho-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.carrinho-card-row-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.carrinho-card-row-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: auto;
}

.carrinho-card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.carrinho-card-title {
    flex: 1 1 110px;
    min-width: 0;
    font-size: 0.85rem;
    color: #333;
    font-weight: normal;
    line-height: 1.3;
    margin-bottom: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.carrinho-card-price {
    margin-left: auto;
    font-size: 1.05rem;
    color: #1a1a1a;
    font-weight: 700;
    white-space: nowrap;
    text-align: right;
}

.carrinho-card-total-secundario {
    font-size: 0.8rem;
    color: #666;
    font-weight: 600;
    white-space: nowrap;
    text-align: right;
}

.btn-excluir {
    background: none;
    border: none;
    color: #E30613;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    transition: opacity 0.2s;
}

.btn-excluir:active {
    opacity: 0.5;
}

.carrinho-checkout-bar {
    background: #fff;
    border-top: 1px solid #eaeaea;
    padding: 15px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 10;
    flex-shrink: 0;
}

.checkout-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.checkout-btn {
    font-weight: 600;
    padding: 10px;
    border-radius: 8px;
    background-color: #E30613;
    border-color: #E30613;
}

.checkout-btn:active {
    background-color: #cc0000 !important;
    border-color: #cc0000 !important;
}

@keyframes pulse-mic {
    0% { background-color: #fff; color: #E30613; }
    50% { background-color: #ffcccc; color: #E30613; }
    100% { background-color: #fff; color: #E30613; }
}

.mic-recording {
    animation: pulse-mic 1s infinite;
    border-color: #E30613 !important;
    z-index: 10;
}

/* Entrada compacta em celulares, preservando espaço entre os blocos. */
@media (max-width: 576px) {
    #cpfContainer {
        padding: 16px !important;
        flex-shrink: 0;
        max-height: none;
        overflow: visible;
    }
    #cpfContainer > h4 {
        font-size: 1.15rem !important;
        margin-bottom: 8px !important;
    }
    #cpfContainer > p {
        margin-bottom: 14px !important;
        line-height: 1.4;
    }
    #cpfContainer > .mb-3,
    #cpfButtonsContainer > .mb-3 {
        margin-bottom: 10px !important;
    }
}
