/* Fonte de marca, self-hosted (sem CDN — restricao de CSP/service worker).
   Variavel 400-800 num arquivo so de 32 KB; o subset latin cobre os acentos
   do PT-BR. Usada em titulo, preco e marca; o corpo de leitura continua na
   fonte do sistema, mais legivel em tela pequena e sem custo de download.
   format('woff2') e nao 'woff2-variations': a sintaxe '-variations' era o
   hack de transicao (Chrome ~62-87) antes dos browsers reconhecerem fontes
   variaveis dentro do format() padrao. A substituicao hoje documentada
   (MDN/web.dev) e `format(woff2) tech(variations)`, mais explicita — mas
   e trade-off, nao regra: format() e so um hint de pre-filtro, nao governa
   a renderizacao apos o download, entao um valor nao reconhecido tem risco
   pratico baixo. Optamos por 'woff2' simples com font-weight em faixa por
   ser o que o parque real de tablets Android e iPad de balcao, com versoes
   de SO fora do nosso controle, tem mais chance de ja reconhecer. */
@font-face {
    font-family: 'Outfit';
    src: url("../fonts/outfit-variable.fdf9c509a809.woff2") format('woff2');
    font-weight: 400 800;
    font-style: normal;
    font-display: swap;
}

/* ========== VARIAVEIS ========== */
:root {
    --hbl-green: #78BE20;
    --hbl-green-dark: #5a9e10;
    --hbl-green-light: #e8f5d6;
    /* Verde dedicado ao fundo de .btn-primary (texto branco). --hbl-green
       (#78BE20) só passa 2.286:1 contra branco — muito abaixo do mínimo
       WCAG AA de 4.5:1 para texto. #4a7d0c passa 4.965:1. Não reusar
       --hbl-green-dark: essa variável é redefinida no dark mode
       (--hbl-green-dark: #8ed44a, um verde CLARO usado como cor de texto
       sobre fundo escuro) e serviria mal como fundo de botão com texto
       branco. --hbl-green-btn não é redefinida no dark mode de propósito —
       o mesmo tom escuro mantém o contraste em ambos os temas. */
    --hbl-green-btn: #4a7d0c;
    /* Hover de .btn-primary. NAO reusar --hbl-green-dark aqui (seria repetir
       o erro que este token corrige): --hbl-green-dark e redefinida no dark
       mode para #8ed44a, um verde CLARO pensado como cor de TEXTO, e como
       fundo com texto branco da so 3.32:1 no claro e 1.80:1 no escuro —
       abaixo do minimo AA. #3f6b0a (mesmo tom de --hbl-toast-success-bg) da
       6.33:1 contra branco (ver core/tests_contraste.py). Nao redefinida no
       dark mode de proposito: o mesmo tom mantem o contraste nos dois temas,
       igual --hbl-green-btn acima. */
    --hbl-green-btn-hover: #3f6b0a;
    /* Fundos que carregam texto branco. Todos derivados do verde da marca,
       todos >=4.5:1 contra #fff (ver core/tests_contraste.py). Motivo de
       existirem separados de --hbl-green: #78BE20 puro da 2.286:1 e reprova
       AA — o lima segue vivo em borda, realce e gradiente do header. */
    --hbl-table-th-bg: #4a7d0c;
    --hbl-toast-success-bg: #3f6b0a;
    --hbl-chip-active-bg: #4a7d0c;
    /* Escala de elevação: sombras para card hover e componentes elevados.
       Criadas na Task 2 porque Task 8 já as precisa; Task 15 buscará todos
       os rgba(...) literais nos componentes. Light mode: sombras suaves
       sobre fundo claro. Dark mode: mais densas (fundo escuro absorve). */
    --shadow-1: 0 1px 3px rgba(26, 26, 46, 0.08);
    --shadow-2: 0 4px 12px rgba(26, 26, 46, 0.12);
    --shadow-3: 0 12px 32px rgba(26, 26, 46, 0.18);
    /* Variante ascendente: superfície ancorada no rodapé (bottom-nav,
       action-bar) precisa projetar sombra para CIMA, não para baixo — uma
       sombra descendente nela cai fora da tela e a separação visual do
       conteúdo some. Não "unificar" com --shadow-2 na Fase 2: são
       direções opostas por necessidade de layout, não descuido. Só a
       variante de --shadow-2 existe porque é a única com consumidor hoje;
       criar --shadow-up-1/3 quando (e se) surgir um. */
    --shadow-up-2: 0 -4px 12px rgba(26, 26, 46, 0.12);
    --hbl-dark: #1a1a2e;
    --hbl-gray: #6c757d;
    --hbl-gray-light: #f0f2f5;
    --hbl-white: #FFFFFF;
    --hbl-danger: #dc3545;
    --hbl-warning: #ffc107;
    /* Nao redefinido no tema escuro, de proposito: --hbl-warning tambem
       nao e redefinido la (mesmo #ffc107 nos dois temas), entao um texto
       escuro fixo mantem o contraste nos dois — mesmo mecanismo de
       --hbl-orange-contador-text (ver core/tests_contraste.py). Medido
       nesta sessao: #ffc107 x #1a1a2e = 10.464:1 (>= 4.5:1 AA) nos dois
       temas; #ffc107 x --text-primary daria 1.330:1 no escuro (falha),
       porque --text-primary vira quase-branco la. */
    --hbl-warning-banner-text: #1a1a2e;
    --hbl-info: #0dcaf0;
    --hbl-orange: #FF6B00;

    --btn-h: 44px;
    --btn-h-lg: 56px;
    --btn-h-sm: 44px; /* alvo de toque WCAG 2.5.5: 44x44 no balcao, ao lado de "Excluir" */
    --nav-h: 80px;
    --header-h: 64px;
    --radius: 12px;
    --gap: 10px;
    --card-min: 200px;
    /* Altura de #barra-pedido, publicada pelo JS (barra.offsetHeight) so
       quando ela esta visivel — o padding-bottom do body reserva esse
       espaco. 0px aqui e o estado padrao/sem-JS: barra escondida, sem vao
       morto no rodape. Ver comentario em `body` e no fix round 1 (achado
       2, Task 2) para o porque de nao fixar 62px direto. */
    --altura-barra-pedido: 0px;
    /* Mesmo padrao para #faixa-offline, que virou position:fixed (achado
       Important da revisao da Fase 2B): publicada pelo JS
       (faixa.offsetHeight) so quando visivel, 0px como padrao/sem-JS. Sem
       isso a faixa fixa cobriria o topo do conteudo ao aparecer. */
    --altura-faixa-offline: 0px;

    --border-light: #e0e0e0;
    --border-subtle: #f0f0f0;
    --border-form: #ccc;
    --bg-hover: #f8f9fa;
    --bg-remove: #fee;
    --hbl-orange-light: #fff3e6;
    --hbl-danger-light: #fde;
    --hbl-warning-bg: #fff3cd;
    --hbl-warning-text: #856404;
    /* Texto do .nav-contador (badge de itens no icone do PDV) sobre
       --hbl-orange. Nao usa --text-primary: essa vira quase-branco no tema
       escuro (#e8e8e8) e --hbl-orange nao e redefinido la, entao o par
       cairia pra ~2.33:1 (medido com core.tests_contraste). Branco puro
       sobre #FF6B00 tambem reprova (2.855:1). #1a1a2e da 5.974:1 — e, como
       --hbl-orange, nao muda de tema, entao o mesmo teste cobre os dois. */
    --hbl-orange-contador-text: #1a1a2e;
    --hbl-disabled-bg: #ccc;
    --hbl-disabled-text: #999;
    /* Anel de :focus-visible — token dedicado, NAO reusar --hbl-green-btn:
       essa e a mesma cor de fundo do .btn-primary e (via --hbl-chip-active-bg,
       mesmo hex) do .category-chip.active, entao o anel virava "borrao verde"
       em cima do proprio preenchimento em vez de um contorno distinto. Medido
       com core.tests_contraste: #1a1a2e da 17.06:1 sobre --hbl-white (card
       claro) e 15.21:1 sobre --hbl-gray-light (pagina clara) — e 3.44:1 contra
       o verde do botao, acima do minimo de 3:1 do WCAG 1.4.11 pra indicador
       nao-textual. */
    --focus-ring: #1a1a2e;

    /* Tipografia. Substitui os 13 tamanhos ad hoc do arquivo. Piso
       operacional: nada de operacao abaixo de 14px. */
    --fonte-marca: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --text-xs: 12px;   --lh-xs: 1.4;
    --text-sm: 14px;   --lh-sm: 1.45;
    --text-base: 16px; --lh-base: 1.55;
    --text-lg: 18px;   --lh-lg: 1.35;
    --text-xl: 22px;   --lh-xl: 1.25;
    --text-2xl: 28px;  --lh-2xl: 1.15;
    --text-3xl: 36px;  --lh-3xl: 1.1;

    /* Camada semantica: os componentes consomem daqui. A camada primitiva
       (--hbl-*) continua sendo a fonte de valor. */
    --surface-1: #f0f2f5;
    --surface-2: #ffffff;
    --surface-3: #f8f9fa;
    --text-primary: #1a1a2e;
    --text-secondary: #565a68;
    --text-muted: #666976;
    /* Conferencia de caixa (Fechar o dia). Cores proprias porque o par
       precisa passar em AA sobre --surface-2 nos DOIS temas e as cores de
       marca nao servem cruas: --hbl-green e --hbl-orange reprovam no claro
       e --hbl-danger reprova no escuro (3.273:1). Medido em
       core.tests_caixa.ContrasteDoFechamentoTests. */
    --verde-texto: #4a7d0c;   /* 4.965:1 sobre branco — verde que passa AA como TEXTO
                                 nos dois temas (--hbl-green-dark da 3.316:1 no claro) */
    --caixa-sobra: #856404;   /* 5.495:1 sobre branco */
    --caixa-falta: #c62230;   /* 5.718:1 sobre branco */
    /* Alerta de receita com ingrediente fora do catalogo */
    --alerta-catalogo-texto: #c62230;
    --alerta-catalogo-bg: #ffe3e6;
    --space-1: 4px;  --space-2: 8px;  --space-3: 12px;
    --space-4: 16px; --space-5: 24px; --space-6: 32px;
    --radius-sm: 6px; --radius-base: 12px; --radius-lg: 20px; --radius-full: 999px;
}

/* ========== RESET ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    background: var(--surface-1);
    color: var(--text-primary);
    /* --altura-barra-pedido comeca em 0px (:root) e o JS publica a altura
       MEDIDA de #barra-pedido quando ela aparece (fix round 1, achado 2:
       fixar um pixel no CSS cobria o botao de finalizar sempre que a altura
       real divergisse — texto do sistema maior, ou "2 itens" virando "12
       itens"). Com a barra escondida a variavel volta a 0px, entao nenhum
       vao morto fica reservado no rodape. */
    padding-bottom: calc(var(--nav-h) + 8px + var(--altura-barra-pedido, 0px));
    -webkit-tap-highlight-color: transparent;
    min-height: 100vh;
    /* Zoom por pinca liberado (WCAG 1.4.4): o <meta viewport> nao tem mais
       user-scalable=no. touch-action aqui (nao em elementos individuais)
       porque se propaga pela cadeia de ancestrais e suprime o
       double-tap-zoom em todos os descendentes, sem bloquear a pinca. */
    touch-action: manipulation;
}

/* #faixa-offline virou position:fixed (achado Important da revisao da
   Fase 2B) e saiu do fluxo — sem isso o topo do conteudo ficaria embaixo
   dela quando aparecesse. Mesmo padrao MEDIDO de --altura-barra-pedido,
   so que reservando espaco no TOPO em vez do rodape. */
main { margin-top: var(--altura-faixa-offline, 0px); }

/* Fonte de marca: so em titulo, preco e marca. O corpo de leitura (acima,
   em body) fica na fonte do sistema — mais legivel em tela pequena e sem
   custo de download. */
.app-header h1,
.page-title,
.modal-title,
.login-title,
.section-title { font-family: var(--fonte-marca); }

/* Utilitarias da escala: o template usa a classe em vez de declarar tamanho
   proprio. Quem precisa de um tamanho fora da escala provavelmente errou. */
.txt-xs   { font-size: var(--text-xs);   line-height: var(--lh-xs); }
.txt-sm   { font-size: var(--text-sm);   line-height: var(--lh-sm); }
.txt-base { font-size: var(--text-base); line-height: var(--lh-base); }
.txt-lg   { font-size: var(--text-lg);   line-height: var(--lh-lg); }
.txt-xl   { font-size: var(--text-xl);   line-height: var(--lh-xl); }
.txt-2xl  { font-size: var(--text-2xl);  line-height: var(--lh-2xl); }
.txt-3xl  { font-size: var(--text-3xl);  line-height: var(--lh-3xl); }

/* Todo numero que o operador compara em coluna. */
.preset-price, .drink-price, .pkg-price,
.cart-item-price, .cart-total-value, .troco-valor,
.summary-card-value, .qty-value,
.stock-table td, .sales-table td {
    font-variant-numeric: tabular-nums;
}

/* ========== HEADER ========== */
.app-header {
    background: linear-gradient(135deg, var(--hbl-green) 0%, var(--hbl-green-dark) 100%);
    color: white;
    height: var(--header-h);
    min-height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 500;
    box-shadow: var(--shadow-2);
    overflow: hidden;
}
.header-logo-link { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; color: inherit; min-width: 0; overflow: hidden; }
.app-header h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.app-header h1 .header-nome-loja { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Simbolo da marca (static/img/marca.svg) — folha que tambem le como copo.
   Usado no header (junto ao nome da loja) e no login (sozinho, maior via
   .login-logo .marca). flex-shrink evita que o header comprima o simbolo
   quando o nome da loja e longo. */
.marca { width: 28px; height: 28px; flex-shrink: 0; vertical-align: -6px; }
.version-badge { font-size: var(--text-xs); font-weight: 500; background: rgba(255,255,255,0.2); padding: 2px 6px; border-radius: 8px; letter-spacing: 0; }
.daily-counter {
    font-size: var(--text-sm);
    font-weight: 600;
    background: rgba(255,255,255,0.2);
    padding: 6px 14px;
    border-radius: 20px;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    /* Sem isto a pilula quebrava em tres linhas nas telas medias (medido a
       620px) e empurrava a altura do cabecalho. Ela so aparece onde cabe
       inteira — ver a regra de <= 900px mais abaixo. */
    white-space: nowrap;
}
.header-right { display: flex; align-items: center; gap: 10px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
/* Chip de usuario: agora e o gatilho do menu (perfil / senha /
   dispositivos / sair). Continua do mesmo tamanho de antes — foi o "Sair"
   solto que espremia o nome da loja em 375px na Fase 2B, e ele nao volta ao
   cabecalho: mora dentro deste menu. */
.header-user {
    font-size: var(--text-sm);
    font-weight: 500;
    opacity: 0.9;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 6px 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.header-user::after { content: '▾'; opacity: 0.8; }
.header-user-icone { display: none; }
.header-user:focus-visible { outline: 2px solid white; outline-offset: 2px; border-radius: var(--radius-sm); }
.menu-usuario-wrap { position: relative; }
.menu-usuario {
    /* fixed, nao absolute: .app-header tem overflow:hidden (guarda do
       estouro lateral em 375px, Fase 1) e cortava o menu a 64px de altura.
       Elemento fixed escapa do clip porque o bloco que o contem e a
       viewport — e o cabecalho, sendo sticky no topo, nao cria bloco de
       contencao. Por isso a ancora aqui e a altura do cabecalho, nao o
       botao. */
    position: fixed;
    top: calc(var(--header-h) + 4px);
    right: var(--space-2);
    min-width: 210px;
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-base);
    box-shadow: var(--shadow-3);
    padding: var(--space-1);
    z-index: 1200;
}
.menu-usuario[hidden] { display: none; }
.menu-usuario-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    min-height: var(--btn-h);
    padding: 0 var(--space-3);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--text-sm);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.menu-usuario-item:hover { background: var(--bg-hover); }
.menu-usuario-item:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: -3px; }
.menu-usuario-sair { border-top: 1px solid var(--border-subtle); margin-top: var(--space-1); padding-top: var(--space-1); }
.conn-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--hbl-green);
    display: inline-block;
    box-shadow: 0 0 4px rgba(120, 190, 32, 0.5);
    transition: background 0.3s, box-shadow 0.3s;
}
.conn-status.offline {
    background: var(--hbl-danger);
    box-shadow: 0 0 4px rgba(220, 53, 69, 0.5);
    animation: pulse-offline 1.5s infinite;
}
@keyframes pulse-offline {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.faixa-offline {
    /* Fixa logo abaixo do cabecalho (que e sticky; top:0; z-index:500):
       em fluxo normal ela rolava para fora da tela junto com o conteudo —
       no PDV, com o operador quase sempre rolado pra baixo (carrinho),
       a queda de conexao ficava sem nenhum aviso visivel enquanto os
       botoes de finalizar iam para disabled/pointer-events:none em
       silencio. z-index acima da barra de pedido (900) e do conteudo,
       abaixo do modal (2000) — o modal continua por cima da faixa. */
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    z-index: 950;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--hbl-warning);
    color: var(--hbl-warning-banner-text);
    font-size: var(--text-sm);
    font-weight: 600;
    text-align: center;
}
.faixa-offline[hidden] { display: none; }

/* ========== NAVEGACAO INFERIOR ========== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-h);
    background: var(--hbl-white);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: var(--shadow-up-2);
    z-index: 1000;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--hbl-gray);
    min-width: 72px;
    min-height: 72px;
    border-radius: 12px;
    transition: color 0.2s, background 0.2s;
    font-size: var(--text-sm);
    /* Padding lateral reduzido de 8px: .nav-label subiu de 12px para 14px
       (piso operacional) e "Financeiro" (o rotulo mais longo, 5 itens em
       390px) precisa do espaco extra pra nao vazar do item. */
    padding: 4px 2px;
}
.nav-item.active {
    color: var(--hbl-green-dark);
    font-weight: 700;
    background: var(--hbl-green-light);
}
.nav-icon { font-size: 28px; margin-bottom: 3px; position: relative; }
.nav-contador {
    position: absolute;
    top: -4px;
    right: -10px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: var(--radius-full);
    background: var(--hbl-orange);
    color: var(--hbl-orange-contador-text);
    font-size: var(--text-xs);
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}
.nav-contador[hidden] { display: none; }
/* letter-spacing negativo (so aqui, nao no resto da escala) compensa o
   ganho de largura de "Financeiro" em --text-sm dentro dos ~72-78px do
   item — ver comentario em .nav-item. */
.nav-label { font-size: var(--text-sm); font-weight: 500; letter-spacing: -0.3px; }

/* O icone herda cor e tamanho do texto ao redor: um arquivo so serve ao
   estado ativo, ao tema escuro e ao hover, sem variante nova. */
.icone { width: 1.25em; height: 1.25em; display: inline-block; vertical-align: -0.15em; flex-shrink: 0; }
.nav-icon .icone { width: 26px; height: 26px; }

/* ========== PDV ABAS SUPERIORES ========== */
.pdv-tabs {
    display: flex;
    gap: 6px;
    padding: 10px 10px 0;
    background: var(--hbl-white);
    border-bottom: 2px solid var(--border-light);
}
.pdv-tab {
    flex: 1;
    padding: 14px 12px;
    border: none;
    background: transparent;
    font-size: 16px;
    font-weight: 600;
    color: var(--hbl-gray);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    border-radius: 10px 10px 0 0;
    min-height: 56px;
    transition: all 0.2s;
}
.pdv-tab:active { background: var(--hbl-gray-light); }
.pdv-tab.active {
    color: var(--hbl-green-dark);
    border-bottom-color: var(--hbl-green);
    background: var(--hbl-green-light);
    font-weight: 700;
}

/* ========== PDV LAYOUT ========== */
.pdv-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: var(--gap);
    padding: var(--gap);
    height: calc(100vh - var(--header-h) - var(--nav-h) - 78px);
    overflow: hidden;
}
#tab-content {
    overflow-y: auto;
}
/* Itens de grid nao encolhem abaixo do conteudo enquanto min-width for auto.
   Com overflow visivel (necessario para a action bar sticky funcionar no
   celular, ver bloco <=900px logo abaixo), o piso de conteudo passa a valer
   e a coluna estica ate caber os chips/descricoes mais largos, trazendo de
   volta a rolagem lateral. */
#tab-content, #cart-area {
    min-width: 0;
}
@media (max-width: 900px) {
    .pdv-layout {
        grid-template-columns: 1fr;
        height: auto;
        /* Sem altura fixa, overflow: hidden nao clipa nada (a caixa cresce
           pro tamanho do conteudo) — so impede #tab-content de virar um
           scrollport de verdade, que e o que .action-bar (sticky bottom)
           precisa pra grudar. Liberando aqui, quem rola e a janela. */
        overflow: visible;
    }
    #tab-content {
        /* Idem: com a altura do pai em auto, este overflow-y: auto nunca
           tinha conteudo pra rolar (a caixa ja nasce do tamanho do
           conteudo) — so bloqueava .action-bar de usar a janela como
           scrollport. Sem isso, "position: sticky; bottom: var(--nav-h)"
           em .action-bar so repousava no fim do fluxo, fora da tela. */
        overflow-y: visible;
    }
}

/* ========== PRESETS GRID ========== */
.section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--hbl-gray);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--border-subtle);
}

.presets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr));
    gap: var(--gap);
    margin-bottom: 16px;
}
.preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* O card de receita vira foto + texto: a foto sangra ate a borda (o
       overflow:hidden abaixo arredonda os cantos dela via var(--radius) do
       proprio botao) e a altura passa a seguir o conteudo, por isso
       aspect-ratio:1 e o padding uniforme saem daqui — quem nao tem foto
       (.preset-custom) recupera o proprio padding e centralizacao. */
    justify-content: flex-start;
    aspect-ratio: auto;
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--surface-2);
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    transition: transform 0.1s, box-shadow 0.15s;
    text-align: center;
    font-size: 16px;
    min-width: 0;
}
.preset-btn:active { transform: scale(0.95); }
.preset-btn .preset-icon { font-size: 40px; margin-bottom: 8px; }
/* overflow-wrap: anywhere (nao break-word) porque o spec so deixa o segundo
   reduzir o min-content de verdade: break-word cria ponto de quebra na
   renderizacao mas nao conta pro calculo de tamanho minimo automatico do
   item de grid, entao a coluna minmax(0,1fr) continuaria esticando pela
   descricao longa mesmo com break-word. anywhere entra no calculo. */
.preset-btn .preset-name { font-weight: 700; font-size: 18px; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.preset-btn .preset-desc { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 4px; overflow-wrap: anywhere; }
.preset-btn .preset-price { font-size: 18px; font-weight: 700; color: var(--hbl-green-dark); margin-top: 6px; }
/* Foto ou placeholder ilustrado no lugar do emoji solto: nunca emoji puro
   ao lado de um card com foto no mesmo grid. 4/3 porque o copo e alto —
   3/2 corta a bebida (medido no render pelo controlador). */
.preset-foto, .preset-placeholder {
    width: 100%;
    aspect-ratio: 4 / 3;
    display: block;
    object-fit: cover;
    background: var(--surface-3);
}
.preset-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-2xl);
}
.preset-corpo {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 10px 12px 12px;
}
.preset-custom {
    border: 2px dashed var(--hbl-green);
    color: var(--hbl-green-dark);
    background: var(--hbl-green-light);
    /* .preset-custom nao tem foto — recupera o padding/centralizacao que
       .preset-btn perdeu para os cards com foto. */
    padding: 12px;
    justify-content: center;
    min-height: 150px;
}

/* Em tablet o card quadrado de 200px+ deixava 4 receitas na dobra de um
   cardapio de 18. Cards mais baixos e mais colunas a partir de 768px. */
@media (min-width: 768px) {
    .presets-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .preset-btn { aspect-ratio: auto; min-height: 150px; }
}

/* ========== MONTADOR DE SHAKE ========== */
.builder-section { margin-bottom: 16px; }
.builder-flavors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr));
    gap: var(--gap);
}
.flavor-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border: 3px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--hbl-white);
    cursor: pointer;
    padding: 12px;
    transition: transform 0.1s, border-color 0.2s;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
}
.flavor-btn:active { transform: scale(0.95); }
.flavor-btn.selected { border-color: var(--hbl-green); background: var(--hbl-green-light); }
.flavor-btn .flavor-name { line-height: 1.2; font-size: 16px; }
.flavor-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--hbl-green);
    color: white;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.addons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr));
    gap: var(--gap);
}
.addon-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--hbl-white);
    cursor: pointer;
    padding: 12px;
    transition: transform 0.1s, border-color 0.2s;
    font-size: 14px;
    text-align: center;
}
.addon-btn:active { transform: scale(0.95); }
.addon-btn.selected { border-color: var(--hbl-orange); background: var(--hbl-orange-light); }
.addon-btn .addon-name { font-weight: 600; font-size: 15px; }
.addon-btn .addon-price { font-size: 14px; color: var(--hbl-orange); font-weight: 600; margin-top: 4px; }
/* Tamanho do pacote no card de adicional: o operador escolhe uma DOSE, mas
   precisa saber de qual embalagem — o mesmo cha existe em 51g e 102g, com
   preco de dose diferente. Informacao de apoio, nunca o titulo. */
.addon-btn .addon-size { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 2px; }

/* ========== PRESET EXTRAS ========== */
.recipe-composition {
    background: var(--hbl-green-light);
    border: 1.5px solid var(--hbl-green);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin: var(--gap);
    margin-bottom: 0;
    position: sticky;
    top: 0;
    z-index: 2;
}
.recipe-composition--simple { padding: 12px 16px; }
.recipe-composition-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.recipe-composition-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--hbl-green-dark);
}
.recipe-composition-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--hbl-green-dark);
    background: var(--hbl-white);
    padding: 3px 12px;
    border-radius: 20px;
    border: 1px solid var(--hbl-green);
    white-space: nowrap;
}
.recipe-composition-items { display: flex; flex-wrap: wrap; gap: 6px; }
.recipe-composition-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--hbl-white);
    border: 1px solid var(--hbl-green);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--hbl-dark);
}
.chip-qty {
    font-size: var(--text-sm);
    font-weight: 700;
    color: white;
    background: var(--hbl-green);
    border-radius: 10px;
    padding: 1px 6px;
    line-height: 1.3;
}
.recipe-composition-chip.chip-flavor { background: var(--hbl-orange-light); border-color: var(--hbl-orange); }
.recipe-composition-chip.chip-flavor .chip-qty { background: var(--hbl-orange); }

.extras-prompt {
    font-size: 14px;
    font-weight: 600;
    color: var(--hbl-gray);
    padding: 12px var(--gap) 0;
}

.extras-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--gap);
    padding: var(--gap);
}
.extras-grid .addon-btn { aspect-ratio: auto; min-height: 90px; padding: 8px; }
.extras-category-label {
    grid-column: 1 / -1;
    font-weight: 700;
    font-size: var(--text-sm);
    color: var(--hbl-gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 0 0;
}

#builder-area { min-height: 100%; }

/* ========== ACTION BAR (PDV sticky footer) ========== */
.action-bar {
    background: var(--hbl-white);
    border: 2px solid var(--hbl-green);
    border-radius: var(--radius);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    position: sticky;
    /* bottom: 0 no contexto padrao (>900px): aqui #tab-content e o proprio
       scrollport (altura fixa + overflow-y: auto) e ja termina acima da
       bottom-nav (ver calc() de .pdv-layout), entao um offset extra so cria
       vao morto. O offset de --nav-h entra so no breakpoint <=900px, onde o
       scrollport passa a ser a janela — ver media query abaixo. */
    bottom: 0;
    z-index: 10;
    box-shadow: var(--shadow-up-2);
}
.action-bar--muted { border-color: var(--border-light); }
.action-bar--muted .action-bar-info { color: var(--hbl-gray); }
.action-bar-info { flex: 1; font-size: 14px; font-weight: 500; min-width: 200px; }
.action-bar-price { font-size: 20px; font-weight: 700; color: var(--hbl-green-dark); white-space: nowrap; }
.action-bar-buttons { display: flex; gap: 8px; }
/* When no info present, buttons expand like .btn-group */
.action-bar-buttons:only-child { flex: 1; }
.action-bar-buttons:only-child .btn { flex: 1; }
.action-bar-buttons:only-child .btn-primary { flex: 2; }

/* ========== BARRA DE PEDIDO (celular) ========== */
/* Resumo fixo do pedido acima da bottom-nav: no celular o operador monta o
   pedido no topo e antes rolava quase duas telas pra ver o total e
   finalizar. So aparece com o pedido nao-vazio (JS le o proprio #cart-area)
   e some no desktop, onde o carrinho ja mora na coluna da direita. */
#barra-pedido {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--nav-h);   /* acima da navegacao, nunca sobre ela */
    display: flex;
    gap: var(--space-2);
    align-items: center;
    padding: var(--space-2) var(--space-3);
    background: var(--surface-2);
    border-top: 2px solid var(--hbl-green);
    box-shadow: var(--shadow-up-2);
    z-index: 900;
}
#barra-pedido[hidden] { display: none; }
.barra-pedido-resumo {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    background: none;
    border: none;
    min-height: var(--btn-h);
    cursor: pointer;
    color: inherit;
    font-family: inherit;
}
.barra-pedido-itens { font-size: var(--text-sm); color: var(--text-secondary); }
.barra-pedido-total { font-size: var(--text-lg); font-weight: 700; color: var(--hbl-green-dark); }
#barra-pedido .btn { flex: 0 0 auto; min-width: 130px; }

@media (min-width: 901px) {
    #barra-pedido { display: none; }
}

/* ========== CARRINHO ========== */
.cart-container {
    background: var(--hbl-white);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: var(--shadow-1);
}
.cart-title {
    font-size: 16px;
    font-weight: 700;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 8px;
}
.cart-items { flex: 1; overflow-y: auto; }
.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
    gap: 8px;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-label { font-size: 14px; font-weight: 600; line-height: 1.3; }
.cart-item-detail { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.4; }
.cart-item-breakdown { display: block; color: var(--hbl-orange); font-weight: 500; }
.cart-item-price { font-size: 15px; font-weight: 700; color: var(--hbl-green-dark); white-space: nowrap; }
.cart-item-remove {
    min-width: 44px;
    min-height: 44px;
    border: none;
    background: var(--bg-remove);
    color: var(--hbl-danger);
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Realce do item recem-adicionado: o carrinho inteiro e trocado a cada
   swap, entao o alvo e sempre o ultimo .cart-item. A regra global de
   prefers-reduced-motion (ver ACESSIBILIDADE: REDUZIR MOVIMENTO) ja zera
   esta animacao com !important — nao precisa de uma segunda regra aqui. */
@keyframes destaqueItemNovo {
    from { background: var(--hbl-green-light); }
    to { background: transparent; }
}
.cart-item--novo { animation: destaqueItemNovo 1.2s ease-out; }

.cart-empty { padding: 40px 0; text-align: center; color: var(--text-secondary); font-size: 14px; }

.cart-summary { border-top: 2px solid var(--border-light); padding-top: 10px; margin-top: auto; }
.cart-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.cart-total-row { font-size: 20px; font-weight: 700; padding: 8px 0; }
.cart-total-value { color: var(--hbl-green-dark); }

.cart-discount-input {
    width: 100px;
    padding: 6px 8px;
    border: 1px solid var(--border-form);
    border-radius: 6px;
    font-size: 14px;
    text-align: right;
}

/* ========== PAGAMENTO ========== */
.payment-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin: 8px 0;
}
.pay-btn {
    min-height: 48px;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    background: var(--hbl-white);
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: 600;
    text-align: center;
    padding: 6px 4px;
    transition: all 0.15s;
    /* .payment-grid usa repeat(N, 1fr) puro (nao minmax(0,1fr)) — com o
       rotulo subindo de 11px para 14px, uma palavra sem espaco ("Dinheiro",
       "Credito") que nao coubesse poderia esticar a coluna 1fr e empurrar
       a grade, mesma classe de regressao ja corrigida em 00e7397 para
       outra grade. overflow-wrap garante que o rotulo quebre dentro do
       botao em vez de forcar a coluna. */
    overflow-wrap: anywhere;
}
.pay-btn.active { border-color: var(--hbl-green); background: var(--hbl-green-light); }
.pay-btn .pay-icon { font-size: 18px; display: block; }
.split-payment-inputs { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.split-payment-row { display: flex; align-items: center; gap: 8px; }
.split-payment-row label { min-width: 80px; font-size: var(--text-sm); font-weight: 600; }
.split-payment-row input { flex: 1; }
.chips-nota { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip-nota {
    min-height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1.5px solid var(--border-light);
    background: var(--hbl-white);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}
.troco-destaque {
    background: var(--hbl-warning-bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}
.troco-rotulo { font-size: 14px; font-weight: 600; color: var(--hbl-warning-text); text-transform: uppercase; letter-spacing: 0.05em; }
.troco-valor { font-size: 36px; font-weight: 800; color: var(--hbl-warning-text); font-variant-numeric: tabular-nums; line-height: 1.1; }

/* ========== BOTOES (DESIGN SYSTEM) ========== */
/* Base — medium (44px) default */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: none; border-radius: var(--radius); cursor: pointer;
    font-weight: 600; font-size: 14px; line-height: 1;
    padding: 0 20px; min-height: var(--btn-h);
    text-decoration: none; transition: all 0.15s;
}
.btn:active { transform: scale(0.97); }

/* Color variants */
.btn-primary { background: var(--hbl-green-btn); color: white; }
.btn-primary:disabled { background: var(--hbl-disabled-bg); color: var(--hbl-disabled-text); cursor: not-allowed; transform: none; }
.btn-secondary { background: var(--border-light); color: var(--hbl-dark); }
.btn-danger { background: var(--hbl-danger); color: white; }
.btn-outline { background: transparent; border: 2px solid var(--hbl-green); color: var(--hbl-green-dark); }

/* Size modifiers */
.btn-lg { min-height: var(--btn-h-lg); font-size: 18px; padding: 0 28px; }
.btn-sm { min-height: var(--btn-h-sm); font-size: var(--text-sm); padding: 0 12px; }

/* Width modifier */
.btn-block { width: 100%; }

/* Hover so onde existe mouse de verdade: em touch, :hover "gruda" apos o
   toque e o card fica com aparencia de selecionado. */
@media (hover: hover) and (pointer: fine) {
    .btn-primary:hover { background: var(--hbl-green-btn-hover); }
    .btn-secondary:hover { background: var(--bg-hover); }
    .btn-danger:hover { filter: brightness(0.92); }
    .btn-outline:hover { background: var(--hbl-green-light); }
    .preset-btn:hover, .flavor-btn:hover, .addon-btn:hover,
    .drink-btn:hover, .package-btn:hover {
        border-color: var(--hbl-green);
        transform: translateY(-2px);
        box-shadow: var(--shadow-2);
    }
    .pay-btn:hover { background: var(--bg-hover); }
    .qty-btn:hover { background: var(--hbl-green-light); }
    .category-chip:hover { border-color: var(--hbl-green); }
}

.btn-nowrap { white-space: nowrap; }
.custom-size-input { display: flex; gap: 6px; align-items: center; }
.form-hint { font-size: var(--text-sm); color: var(--hbl-gray); margin: 2px 0 8px; }
.size-checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 4px; }
.size-checkbox-item { display: flex; align-items: center; gap: 4px; font-size: 14px; padding: 4px 6px; border-radius: 4px; cursor: pointer; }
.size-checkbox-item:hover { background: var(--hbl-green-light); }

/* Form action bar (Cancel + Save) */
.btn-group { display: flex; gap: 8px; margin-top: 16px; }
.btn-group .btn { flex: 1; }
.btn-group .btn-primary { flex: 2; }

/* ========== MODAL ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 16px;
}
.modal-content {
    background: var(--hbl-white);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-title { font-size: 20px; font-weight: 700; margin-bottom: 16px; }
.modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--hbl-gray);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* ========== DIALOGO DE CONFIRMACAO ========== */
.dialogo-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    z-index: 2000;
}
.dialogo-overlay[hidden] { display: none; }
.dialogo-caixa {
    background: var(--surface-2);
    color: var(--text-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-3);
}
.dialogo-titulo { font-size: var(--text-xl); font-weight: 700; margin-bottom: var(--space-2); }
.dialogo-mensagem { font-size: var(--text-base); line-height: var(--lh-base); margin-bottom: var(--space-4); }
.dialogo-acoes { display: flex; gap: var(--space-2); }
.dialogo-acoes .btn { flex: 1; min-height: var(--btn-h); }

/* ========== FLAVOR SELECTOR MODAL ========== */
.flavor-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr));
    gap: var(--gap);
}
.flavor-select-btn {
    aspect-ratio: 1;
    border: 3px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--hbl-white);
    cursor: pointer;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.flavor-select-btn:active { transform: scale(0.95); }
.flavor-select-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.flavor-counter {
    font-size: var(--text-sm);
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--hbl-green-light);
    color: var(--hbl-green-dark);
}
.flavor-counter--full {
    background: var(--hbl-orange);
    color: white;
}
.flavor-selected {
    border-color: var(--hbl-green) !important;
    background: var(--hbl-green-light);
    box-shadow: 0 0 0 2px var(--hbl-green-light);
}
.flavor-selections-strip {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 12px;
}
.flavor-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border: 2px solid var(--border-light);
    border-radius: 20px;
    background: var(--hbl-white);
    font-size: 14px;
    font-weight: 600;
}

/* ========== BEBIDAS GRID ========== */
.drinks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr));
    gap: var(--gap);
}
.drink-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--surface-2);
    cursor: pointer;
    padding: 14px 12px;
    transition: transform 0.1s;
    text-align: center;
    min-width: 0;
}
.drink-btn:active { transform: scale(0.95); }
.drink-btn .drink-name { font-weight: 600; font-size: 16px; line-height: 1.2; }
.drink-btn .drink-price { font-size: 18px; font-weight: 700; color: var(--hbl-green-dark); margin-top: 6px; }
.drink-btn--sem-preco { opacity: 0.55; cursor: not-allowed; }
.drink-price--vazio { color: var(--text-secondary); font-weight: 600; font-size: var(--text-sm); }

/* ========== PRODUTO FECHADO GRID ========== */
.package-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr));
    gap: var(--gap);
}
.package-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--surface-2);
    cursor: pointer;
    padding: 14px 12px;
    transition: transform 0.1s;
    text-align: center;
    min-width: 0;
}
.package-btn:active { transform: scale(0.95); }
.package-btn .pkg-name { font-weight: 600; font-size: 16px; line-height: 1.2; }
.package-btn .pkg-size { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 4px; }
.package-btn .pkg-price { font-size: 18px; font-weight: 700; color: var(--hbl-green-dark); margin-top: 6px; }
.package-btn--sem-preco { opacity: 0.55; cursor: not-allowed; }
.pkg-price--vazio { color: var(--text-secondary); font-weight: 600; font-size: var(--text-sm); }

/* ========== ESTOQUE ========== */
.stock-table-wrap { overflow-x: auto; border-radius: var(--radius); background: var(--hbl-white); }
.stock-table { width: 100%; border-collapse: collapse; }
.tabela-colunas-fixas { width: 100%; display: table; table-layout: fixed; }
.stock-table th { background: var(--hbl-table-th-bg); color: white; padding: 10px; text-align: left; font-size: var(--text-sm); font-weight: 600; white-space: nowrap; border-bottom: 2px solid var(--border-light); }
.stock-table td { padding: 10px; border-bottom: 1px solid var(--border-subtle); font-size: 14px; }
/* Sem esta regra, <small> herda o "smaller" (83,3%) do UA stylesheet sobre
   os 14px de .stock-table td = 11,67px — fura o piso mesmo sem nenhum
   font-size literal declarado. Usado para o tamanho da embalagem ("550g"). */
.stock-table small { font-size: var(--text-sm); }
.stock-table tr:hover { background: var(--bg-hover); }
.stock-table .product-group-header:hover { background: none; }
.product-thumb-cell { width: 64px; text-align: center; padding: 4px !important; }
.product-list-thumb { width: 56px; height: 56px; object-fit: contain; border-radius: 6px; }
.product-list-nophoto { font-size: var(--text-xs); color: var(--hbl-gray); display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; background: var(--hbl-gray-light); border-radius: 6px; text-align: center; }
.stock-ok { color: var(--hbl-green-dark); }
.stock-low {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--hbl-warning-bg);
    color: var(--hbl-warning-text);
    font-weight: 700;
}
.stock-out { color: var(--hbl-danger); font-weight: 700; }
.stock-bar { height: 8px; border-radius: 4px; background: var(--border-light); overflow: hidden; width: 80px; display: inline-block; }
.stock-bar-fill { height: 100%; border-radius: 4px; }

/* ========== PRODUCT GROUP HEADERS ========== */
.product-group-header td {
    padding: 12px 14px !important;
    border-bottom: none !important;
    border-left: 3px solid var(--hbl-gray);
    font-weight: 700; font-size: 14px; color: var(--hbl-dark);
}
.product-group-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; height: 22px; padding: 0 6px;
    border-radius: 11px; font-size: var(--text-xs); font-weight: 600;
    background: var(--hbl-gray-light); color: var(--hbl-gray);
    margin-left: 6px;
}

/* ========== SUGESTÃO DE COMPRAS ========== */
.suggestion-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: var(--text-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.suggestion-urgente { background: var(--hbl-danger-light); color: var(--hbl-danger); }
.suggestion-comprar { background: var(--hbl-orange-light); color: var(--hbl-orange); }
.suggestion-atencao { background: var(--hbl-warning-bg); color: var(--hbl-warning-text); }
.suggestion-ok { background: var(--hbl-green-light); color: var(--hbl-green-dark); }
.suggestion-sem_dados { background: var(--hbl-gray-light); color: var(--hbl-gray); }

/* ========== FINANCEIRO ========== */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr));
    gap: var(--gap);
    margin-bottom: 16px;
}
.summary-card {
    background: var(--surface-2);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-1);
}
.summary-card-label { font-size: var(--text-sm); color: var(--text-secondary); font-weight: 600; text-transform: uppercase; }
.summary-card-value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.summary-card-value.positive { color: var(--hbl-green-dark); }
.summary-card-value.negative { color: var(--hbl-danger); }

.date-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    align-items: center;
}
.date-filters input[type="date"] {
    padding: 8px 10px;
    border: 1px solid var(--border-form);
    border-radius: 8px;
    font-size: 14px;
}
.quick-date-btn {
    padding: 8px 14px;
    border: 1px solid var(--border-form);
    border-radius: 8px;
    background: var(--hbl-white);
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: 500;
    min-height: var(--btn-h-sm);
    /* Mesmo par que .config-tab recebeu: sem isso o rotulo fica colado no
       topo do alvo de 44px em vez de centralizado (a maioria destes sao
       <a>, blocados por .date-filters (display: flex), entao o texto nao
       centraliza sozinho). */
    display: inline-flex;
    align-items: center;
}
.quick-date-btn,
.quick-date-btn:link,
.quick-date-btn:visited {
    color: var(--hbl-dark);
    text-decoration: none;
}
.quick-date-btn.active { background: var(--hbl-green); color: white; border-color: var(--hbl-green); }

.chart-container { background: var(--hbl-white); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.chart-grid { display: grid; grid-template-columns: 2fr 1fr; gap: var(--gap); margin-bottom: 16px; }

.sales-table { width: 100%; border-collapse: collapse; background: var(--hbl-white); border-radius: var(--radius); overflow: hidden; }
.sales-table th { background: var(--bg-hover); padding: 10px; text-align: left; font-size: var(--text-sm); font-weight: 600; border-bottom: 2px solid var(--border-light); }
.sales-table td { padding: 10px; border-bottom: 1px solid var(--border-subtle); font-size: 14px; }
.sales-table tr:hover { background: var(--bg-hover); }
.sales-table tr.clickable-row { cursor: pointer; }

/* ── Combo do Dia ──────────────────────────────────────────────────────
   Escolha diaria do dono: um card-heroi no topo do Cardapio, com o
   "ambiente" da categoria da receita (--ambiente-combo vem do template,
   como ja fazem os cards de preset). So destaque — o preco e o normal. */
.combo-do-dia {
    display: flex; align-items: center; gap: var(--space-3);
    width: 100%; text-align: left; cursor: pointer;
    padding: var(--space-3);
    margin-bottom: var(--space-4);
    background: var(--surface-2);
    border: 2px solid var(--ambiente-combo, var(--hbl-green));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
    min-height: var(--btn-h-lg);
}
.combo-do-dia:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.combo-do-dia-wrap { position: relative; display: flex; }
.combo-do-dia-wrap > .combo-do-dia { width: 100%; }
.combo-do-dia-foto,
.combo-do-dia-placeholder {
    width: 88px; height: 88px; flex-shrink: 0;
    border-radius: var(--radius-base); object-fit: cover;
    display: flex; align-items: center; justify-content: center;
    font-size: var(--text-2xl);
}
.combo-do-dia-placeholder { background: var(--surface-3); }
.combo-do-dia-corpo { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.combo-do-dia-selo,
.selo-combo {
    /* --text-sm, nao --text-xs: o selo e texto de operacao e o piso de 14px
       da Fase 2A vale aqui (core.tests_tipografia). */
    display: inline-flex; align-items: center; gap: 4px;
    font-size: var(--text-sm); font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--caixa-sobra);
}
.combo-do-dia-nome { font-size: var(--text-lg); font-weight: 700; color: var(--text-primary); }
.combo-do-dia-desc { font-size: var(--text-sm); color: var(--text-secondary); overflow-wrap: anywhere; }
/* --verde-texto, nao --hbl-green-btn: esse ultimo nao muda no tema escuro e
   daria 2.98:1 sobre o card escuro (medido no browser). */
.combo-do-dia-preco { font-size: var(--text-base); font-weight: 700; color: var(--verde-texto); margin-top: 2px; }
.acoes-receita { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Atalho "adicionar direto" no card de receita ──────────────────────
   O card inteiro continua abrindo o caminho completo (sabor > extras); o
   botao redondo no canto pula os extras. Fica FORA do .preset-btn porque
   botao dentro de botao e HTML invalido — dai o .preset-wrap. */
.preset-wrap { position: relative; display: flex; }

/* Cadastro rapido de cliente dentro do checkout */
/* Carteira de fiado: o total a receber e quantos devem, antes da lista */
.carteira-resumo {
    display: flex; gap: var(--space-3); flex-wrap: wrap;
    margin-bottom: var(--space-3);
}
.carteira-bloco {
    flex: 1 1 160px;
    display: flex; flex-direction: column; gap: 2px;
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-base);
    padding: var(--space-3);
}
.carteira-rotulo { font-size: var(--text-sm); color: var(--text-secondary); }
/* Hub de Ajustes: cada area em card, com uma linha explicando o que e */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}
.hub-card {
    display: flex; flex-direction: column; gap: 4px;
    padding: var(--space-4);
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-base);
    box-shadow: var(--shadow-1);
    text-decoration: none;
    color: var(--text-primary);
    min-height: var(--btn-h-lg);
}
.hub-card:hover { border-color: var(--hbl-green); }
.hub-card:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.hub-card-icone { width: 28px; height: 28px; color: var(--hbl-green-dark); }
.hub-card-nome { font-weight: 700; font-size: var(--text-base); }
.hub-card-dica { font-size: var(--text-sm); color: var(--text-secondary); }

/* Menu "..." de acoes secundarias nas listas */
.acoes-linha { display: flex; gap: 6px; align-items: center; }
.menu-acoes { position: relative; }
.menu-acoes-gatilho {
    width: var(--btn-h); height: var(--btn-h);
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary); font-size: var(--text-lg); line-height: 1;
    cursor: pointer;
}
.menu-acoes-gatilho:hover { background: var(--bg-hover); }
.menu-acoes-gatilho:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.menu-acoes-lista {
    position: absolute; top: calc(100% + 4px); right: 0;
    min-width: 180px; z-index: 30;
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-base);
    box-shadow: var(--shadow-3);
    padding: var(--space-1);
}
.menu-acoes-lista[hidden] { display: none; }
.menu-acoes-item {
    display: flex; align-items: center; width: 100%;
    min-height: var(--btn-h); padding: 0 var(--space-3);
    background: none; border: none; border-radius: var(--radius-sm);
    color: var(--text-primary); font-size: var(--text-sm); text-align: left;
    text-decoration: none; cursor: pointer;
}
.menu-acoes-item:hover { background: var(--bg-hover); }
.menu-acoes-item:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: -3px; }
.menu-acoes-item--perigo { color: var(--caixa-falta); font-weight: 600; }

/* Badge de estoque no card do PDV. Informa, nao bloqueia: vender sem
   estoque continua permitido (decisao do dono). */
.badge-estoque {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1.3;
}
.badge-estoque--ok { color: var(--text-secondary); background: var(--surface-3); }
.badge-estoque--baixo { color: var(--caixa-sobra); background: var(--hbl-warning-bg); }
.badge-estoque--zero { color: var(--caixa-falta); background: var(--hbl-danger-light); }

/* Receita que leva ingrediente fora do catalogo.
   Avisa, nao bloqueia: se o pote ainda esta no balcao, a venda tem que sair.
   Ver Recipe.ingredientes_indisponiveis. */
.badge-indisponivel {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    align-self: center;
    margin: 0 var(--space-2) var(--space-2);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 700;
    line-height: 1.3;
    color: var(--alerta-catalogo-texto);
    background: var(--alerta-catalogo-bg);
}
.badge-indisponivel .icone { width: 14px; height: 14px; }

.aviso-indisponivel {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin-top: var(--space-2);
    padding: var(--space-2) 10px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--alerta-catalogo-texto);
    background: var(--alerta-catalogo-bg);
    color: var(--alerta-catalogo-texto);
    font-size: var(--text-sm);
    line-height: 1.4;
}
.aviso-indisponivel .icone { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

.hub-card-alerta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--alerta-catalogo-texto);
    background: var(--alerta-catalogo-bg);
}
.hub-card-alerta .icone { width: 14px; height: 14px; }

/* Top 5 do periodo no Financeiro */
.top-itens {
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-base);
    padding: var(--space-3);
    margin-bottom: var(--space-4);
}
.top-itens-lista { list-style: decimal inside; margin: 0; padding: 0; }
.top-itens-lista li {
    display: flex; justify-content: space-between; gap: var(--space-2);
    padding: 6px 0; border-bottom: 1px solid var(--border-subtle);
    font-size: var(--text-sm);
}
.top-itens-lista li:last-child { border-bottom: none; }
.top-itens-qtd { font-weight: 700; color: var(--verde-texto); }

.cliente-relacionamento {
    display: flex; gap: var(--space-4); flex-wrap: wrap;
    margin-bottom: var(--space-3);
    font-size: var(--text-sm); color: var(--text-secondary);
}
.carteira-valor { font-size: var(--text-xl); color: var(--caixa-falta); }
.carteira-valor--neutro { color: var(--text-primary); }

.campo-cliente-linha { display: flex; gap: var(--space-2); align-items: center; }
.campo-cliente-linha .form-control { flex: 1; min-width: 0; }
.campo-cliente-linha .btn { flex-shrink: 0; white-space: nowrap; }
.cliente-rapido {
    margin-top: var(--space-2);
    padding: var(--space-3);
    background: var(--surface-3);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-base);
}
.cliente-rapido .form-group:last-of-type { margin-bottom: var(--space-2); }
.preset-wrap > .preset-btn { width: 100%; }
.preset-atalho {
    position: absolute; top: var(--space-2); right: var(--space-2);
    width: var(--btn-h); height: var(--btn-h);
    display: flex; align-items: center; justify-content: center;
    border: none; border-radius: var(--radius-full);
    background: var(--hbl-green-btn); color: white;
    box-shadow: var(--shadow-2); cursor: pointer;
}
.preset-atalho:hover { background: var(--hbl-green-btn-hover); }
.preset-atalho:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* ── Fechar o dia (conferencia de caixa) ───────────────────────────────
   Esperado x contado, com a diferenca legivel de relance. As cores saem de
   tokens proprios (--caixa-*), medidos nos dois temas. */
.page-subtitle { color: var(--text-secondary); font-size: var(--text-sm); margin: -4px 0 var(--space-4); }
.date-filters label { font-size: var(--text-sm); font-weight: 600; color: var(--text-secondary); }
.fechamento-certinho { color: var(--verde-texto); font-weight: 600; }
.fechamento-sobra { color: var(--caixa-sobra); font-weight: 600; }
.fechamento-falta { color: var(--caixa-falta); font-weight: 600; }
.fechamento-neutro { color: var(--text-muted); }
.aviso-caixa {
    display: flex; gap: var(--space-2); align-items: flex-start;
    background: var(--surface-3);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--hbl-info);
    border-radius: var(--radius-base);
    padding: var(--space-3);
    margin-bottom: var(--space-3);
    font-size: var(--text-sm);
}
.aviso-caixa--alerta { border-left-color: var(--caixa-sobra); }
.aviso-caixa .icone { flex-shrink: 0; }

/* ========== CLIENTES ========== */
.client-card {
    background: var(--hbl-white);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-1);
}
.client-balance { font-size: 16px; font-weight: 700; }
.client-balance.has-debt { color: var(--hbl-danger); }

/* ========== FORMS ========== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: var(--text-sm); font-weight: 600; margin-bottom: 4px; color: var(--hbl-gray); }
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-form);
    border-radius: 8px;
    font-size: 16px;
    background: var(--hbl-white);
}
.form-control:focus { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-color: var(--hbl-green); }

.search-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.search-wrap .form-control,
.search-wrap .pdv-search-input { padding-right: 32px; }
.search-clear {
    position: absolute;
    right: 6px;
    width: 24px;
    height: 24px;
    border: none;
    background: var(--border-light);
    color: var(--hbl-gray);
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.search-clear:hover { background: var(--hbl-danger); color: #fff; }

/* ========== TOAST ========== */
.toast-container { position: fixed; top: 12px; right: 12px; z-index: 3000; display: flex; flex-direction: column; gap: 6px; }
.toast {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    /* padding-right 48px: casa com .toast-close (right:4px, min-width:44px
       -> ocupa ate 48px da borda). 32px deixava os ultimos 16px do texto
       por baixo do alvo de 44px do botao de fechar. */
    padding: 12px 48px 12px 20px;
    border-radius: 8px;
    color: white;
    font-size: 15px;
    font-weight: 500;
    animation: slideIn 0.3s ease;
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 420px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.toast-icone { width: 20px; height: 20px; flex-shrink: 0; }
.toast-text {
    flex: 1;
}
.toast-close {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: inherit;
    font-size: var(--text-lg);
    cursor: pointer;
    /* alvo de 44px: o fechar do toast fica na beira da tela, onde o polegar
       erra mais */
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    opacity: 0.7;
}
.toast-close:hover {
    opacity: 1;
}
.toast-success { background: var(--hbl-toast-success-bg); }
.toast-error { background: var(--hbl-danger); }
.toast-warning { background: var(--hbl-warning); color: var(--hbl-dark); }
.toast-info { background: var(--hbl-info); display: flex; align-items: center; gap: 8px; }
.toast-undo-btn {
    background: none;
    border: 1px solid currentColor;
    color: inherit;
    padding: 2px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    margin-left: 8px;
    font-size: var(--text-sm);
}
.toast-undo-btn:hover {
    opacity: 0.8;
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ========== ESTADO VAZIO ========== */
.estado-vazio {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-6) var(--space-4);
    text-align: center;
}
.estado-vazio-icone { width: 40px; height: 40px; color: var(--text-muted); }
.estado-vazio-titulo { font-size: var(--text-base); font-weight: 600; color: var(--text-primary); }
.estado-vazio-dica { font-size: var(--text-sm); color: var(--text-secondary); max-width: 32ch; }

/* ========== INDICADOR DE PASSO (fluxo de receita) ========== */
.indicador-passo {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
}
.indicador-passo-contagem { font-weight: 700; color: var(--hbl-green-dark); }
.indicador-passo-rotulo { color: var(--text-secondary); }

/* ========== PAGINA CONTAINER ========== */
.page-container { padding: var(--gap); max-width: 1200px; margin: 0 auto; }
.page-title { font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.breadcrumb {
    font-size: var(--text-sm);
    color: var(--hbl-gray);
    margin-bottom: 8px;
}
.breadcrumb a {
    color: var(--hbl-green-dark);
    text-decoration: none;
    font-weight: 500;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { margin: 0 4px; }

/* ========== QTY CONTROLS ========== */
.qty-controls { display: flex; align-items: center; gap: 4px; }
.qty-btn {
    min-width: 44px;
    min-height: 44px;
    border: 2px solid var(--border-light);
    border-radius: 50%;
    background: var(--hbl-white);
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qty-value { font-size: 16px; font-weight: 700; min-width: 24px; text-align: center; }

/* ========== MESSAGES ========== */
.messages { list-style: none; padding: 8px; }
.messages li { padding: 10px 16px; margin-bottom: 6px; border-radius: 8px; font-size: 14px; }
.messages .success { background: var(--hbl-green-light); color: var(--hbl-green-dark); }
.messages .error { background: var(--hbl-danger-light); color: var(--hbl-danger); }
.messages .warning { background: var(--hbl-warning-bg); color: var(--hbl-warning-text); }

/* ========== EMOJI PICKER ========== */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 6px;
}
.emoji-btn {
    height: 52px;
    font-size: 28px;
    border: 2px solid var(--border-light);
    border-radius: 10px;
    background: var(--hbl-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.emoji-btn:active { transform: scale(0.9); }
.emoji-btn.emoji-selected {
    border-color: var(--hbl-green);
    background: var(--hbl-green-light);
    transform: scale(1.1);
}
.emoji-btn-none {
    height: 52px;
    font-size: var(--text-sm);
    border: 2px dashed var(--border-light);
    border-radius: 10px;
    background: var(--hbl-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hbl-gray);
    transition: all 0.15s;
}
.emoji-btn-none.emoji-selected {
    border-color: var(--hbl-green);
    background: var(--hbl-green-light);
    color: var(--hbl-green-dark);
}

/* ========== PRODUCT CARD IMAGES ========== */
.card-product-img {
    width: 80%;
    max-height: 100px;
    object-fit: contain;
    margin-bottom: 6px;
    pointer-events: none;
    flex-shrink: 0;
}

/* ========== IMAGE PICKER ========== */
.image-picker-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 2px dashed var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s;
    overflow: hidden;
    word-break: break-all;
}
.image-picker-preview:hover {
    border-color: var(--hbl-green);
}
.image-picker-toolbar {
    display: flex;
    gap: 8px;
    align-items: stretch;
    margin-bottom: 8px;
}
.image-picker-toolbar .btn {
    flex-shrink: 0;
    white-space: nowrap;
}
.image-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
    padding: 4px;
}
.image-picker-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--hbl-white);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.image-picker-item:hover {
    border-color: var(--hbl-green);
}
.image-picker-item.selected {
    border-color: var(--hbl-green);
    box-shadow: 0 0 0 2px var(--hbl-green-light);
}
.image-picker-item img {
    width: 72px;
    height: 72px;
    object-fit: contain;
}
.image-picker-label {
    font-size: var(--text-sm);
    color: var(--hbl-gray);
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
    max-width: 100%;
}

.image-picker-item.web-downloading {
    opacity: 0.5;
    pointer-events: none;
    border-color: var(--hbl-green);
}

/* ========== RECIPE INGREDIENT CARD ========== */
.ingredient-card {
    background: var(--hbl-gray-light);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
}
.ingredient-slot-hint {
    font-size: var(--text-sm);
    color: var(--hbl-green-dark);
    background: var(--hbl-green-light);
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    line-height: 1.4;
}

/* ========== MOVE (REORDER) BUTTONS ========== */
.btn-move {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--hbl-white);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--hbl-gray);
    transition: all 0.15s;
    padding: 0;
    line-height: 1;
}
.btn-move:hover { background: var(--hbl-green-light); color: var(--hbl-green-dark); border-color: var(--hbl-green); }
.btn-move:active { transform: scale(0.9); }
.btn-move-disabled { opacity: 0.25; cursor: default; pointer-events: none; }

/* ========== BUILDER REMOVE BUTTON ========== */
.builder-remove-btn {
    position: absolute;
    bottom: -10px;
    left: -10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--hbl-danger);
    color: white;
    border: 2px solid var(--hbl-white);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: transform 0.15s, filter 0.15s;
}
.builder-remove-btn::before { content: ''; position: absolute; inset: -6px; border-radius: 50%; }
.builder-remove-btn:hover, .builder-remove-btn:active { filter: brightness(0.85); transform: scale(1.15); }

/* ========== HTMX LOADING & FEEDBACK ========== */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-indicator.htmx-request { display: inline-block; }

/* Global spinner pill — topo central */
.global-spinner {
    position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
    z-index: 4000; background: rgba(0,0,0,0.75); color: white;
    padding: 8px 20px; border-radius: 20px; font-size: var(--text-sm); font-weight: 500;
    display: none; align-items: center; gap: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    pointer-events: none;
}
.htmx-request .global-spinner, .global-spinner.htmx-request {
    display: inline-flex;
}
.global-spinner::after { content: 'Carregando…'; }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
    width: 16px; height: 16px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: white; border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* HTMX: desabilita elemento que disparou request (anti duplo-clique) */
.htmx-request { pointer-events: none; opacity: 0.6; cursor: wait; }
.htmx-request .btn { pointer-events: none; }

/* Form submit: estado "aguardando" */
.btn[disabled] { pointer-events: none; opacity: 0.6; cursor: wait; }
.btn:focus-visible, .nav-item:focus-visible, .pdv-tab:focus-visible,
.config-tab:focus-visible, .preset-btn:focus-visible, .flavor-btn:focus-visible,
.addon-btn:focus-visible, .drink-btn:focus-visible, .package-btn:focus-visible,
.pay-btn:focus-visible, .qty-btn:focus-visible, .cart-item-remove:focus-visible,
.category-chip:focus-visible, .flavor-select-btn:focus-visible, .chip-nota:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, var(--border-subtle) 25%, var(--border-light) 50%, var(--border-subtle) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
    min-height: 60px;
}
.skeleton-line {
    height: 16px;
    margin-bottom: 8px;
    border-radius: 4px;
}
.skeleton-card {
    height: 120px;
    border-radius: var(--radius);
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========== ALPINE.JS CLOAK ========== */
[x-cloak] { display: none !important; }

/* ========== MOVIMENTO (HTMX / MODAIS) ========== */
/* Entrada dos conteudos trocados por HTMX. 150ms: perceptivel como
   continuidade, curto o bastante para nao atrasar a proxima venda.
   Usa .htmx-settling (nao .htmx-added): o htmx aplica .htmx-settling
   ao proprio elemento-alvo do swap (settleInfo.elts inclui o target em
   todo swap innerHTML — verificado no source do htmx 2.0.4), enquanto
   .htmx-added so marcaria o filho recem-inserido — e a maioria das
   respostas do PDV nao se reembrulha no mesmo id do alvo, entao esse
   seletor nunca bateria (toques no builder, troca de aba, +/- do
   carrinho ficariam mudos).
   LIMITE CONHECIDO — NAO cobre swap OOB: isto anima #tab-content,
   #builder-area e #cart-area apenas quando cada um e o ALVO DIRETO de
   um hx-swap="innerHTML" (ex.: os botoes +/- e remover do proprio
   cart.html, que tem hx-target="#cart-area"). hx-swap-oob="innerHTML"
   e outro caminho de codigo: oobSwap() reaproveita o settleInfo da
   requisicao principal e nunca insere o alvo OOB em settleInfo.elts,
   entao esse alvo nunca ganha .htmx-settling. Na pratica isso significa
   que o caminho MAIS COMUM de atualizar o carrinho — adicionar item via
   preset/builder/bebida/pacote, que atualiza #cart-area por OOB (ver
   builder_and_cart.html:9 e preset_added.html:9) — NAO anima. Antes de
   construir o skeleton da Fase 2 em cima disto, nao assuma que todo
   swap para estes 3 ids anima; so os diretos animam. */
@keyframes entradaSuave {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}
#tab-content.htmx-settling, #builder-area.htmx-settling, #cart-area.htmx-settling {
    animation: entradaSuave 150ms ease-out;
}
.modal-overlay { animation: entradaSuave 120ms ease-out; }
.modal-content { animation: pop 160ms cubic-bezier(0.2, 0.9, 0.3, 1.2); }
@keyframes pop {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: none; }
}

/* ========== LOGIN ========== */
.login-body {
    background: var(--hbl-green);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding-bottom: 0;
}
.login-card {
    background: var(--hbl-white);
    border-radius: var(--radius);
    padding: 40px 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-3);
    text-align: center;
}
.login-logo { margin-bottom: 8px; }
.login-logo .marca { width: 64px; height: 64px; }
.login-title { font-size: 22px; font-weight: 700; color: var(--hbl-dark); margin-bottom: 24px; }
.login-error {
    background: var(--hbl-danger-light);
    color: var(--hbl-danger);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}
.login-success {
    background: var(--hbl-green-light);
    color: var(--hbl-green-dark);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
}
.login-card .form-group { text-align: left; }
.password-wrapper {
    position: relative;
}
.password-wrapper .form-control {
    padding-right: 48px;
}
.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    line-height: 1;
}

/* ── Login checkboxes ── */
.login-checkbox-group {
    margin-bottom: 10px;
    text-align: left;
    transition: opacity 0.2s;
}
.login-checkbox-group.login-checkbox-disabled {
    opacity: 0.45;
    pointer-events: none;
}
.login-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--hbl-dark);
    min-height: 44px;
    padding: 4px 0;
    user-select: none;
    -webkit-user-select: none;
}
.login-checkbox input[type="checkbox"] {
    width: 22px;
    height: 22px;
    accent-color: var(--hbl-green);
    cursor: pointer;
    flex-shrink: 0;
}
.login-checkbox-hint {
    font-size: var(--text-sm);
    color: var(--hbl-gray);
    margin: -4px 0 0 32px;
    line-height: 1.4;
}

/* ── Trusted device cards ── */
.device-card {
    background: var(--hbl-white);
    padding: 14px 16px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    border: 2px solid transparent;
}
.device-card-current {
    border-color: var(--hbl-green);
    background: var(--hbl-green-light);
}
.device-info { flex: 1; min-width: 0; }
.device-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--hbl-dark);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.device-badge-current {
    font-size: var(--text-sm);
    font-weight: 600;
    background: var(--hbl-green);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
}
.device-meta {
    font-size: var(--text-sm);
    color: var(--hbl-gray);
    margin-top: 4px;
}

/* ========== PDV FILTER BAR ========== */
.pdv-filter-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--hbl-gray-light);
    padding: 8px 0 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pdv-search-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--border-form);
    border-radius: 8px;
    font-size: 15px;
    background: var(--hbl-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") 12px center no-repeat;
}
.pdv-search-input:focus { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-color: var(--hbl-green); }
.category-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding-bottom: 2px;
}
.category-chip {
    /* Serve para <button> e para <a> (a carteira de fiado filtra por link,
       para o estado caber na URL). Sem o reset abaixo o chip de link saia
       azul e sublinhado. Mesmo caminho que .config-tab ja fez ao aceitar
       <button>. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--border-light);
    background: var(--hbl-white);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    min-height: 44px;
}
.category-chip:active { transform: scale(0.95); }
.category-chip.active {
    background: var(--hbl-chip-active-bg);
    color: white;
    border-color: var(--hbl-chip-active-bg);
}
.category-chip--danger {
    border-color: var(--hbl-danger);
    color: var(--hbl-danger);
}
.category-chip--danger.active {
    background: var(--hbl-danger);
    border-color: var(--hbl-danger);
    color: white;
}

/* ========== CONFIG TABS (pill sub-navigation) ========== */
.config-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.config-tab {
    padding: 8px 20px;
    border-radius: 20px;
    border: 1.5px solid var(--border-light);
    background: var(--hbl-white);
    font-size: 14px;
    font-weight: 600;
    color: var(--hbl-gray);
    text-decoration: none;
    transition: all 0.15s;
    cursor: pointer;
    font-family: inherit;
    min-height: var(--btn-h-sm);
    display: inline-flex;
    align-items: center;
}
.config-tab:hover { background: var(--bg-hover); }
.config-tab.active {
    background: var(--hbl-green);
    color: white;
    border-color: var(--hbl-green);
}

/* ========== GLOBAL SEARCH OVERLAY ========== */
.header-search-btn {
    /* Mesma familia do .theme-toggle e do menu de usuario: icone sem moldura
       propria. Com fundo e borda claros ela era o unico quadrado destacado do
       cabecalho e destoava (apontado pelo dono em 20/08). */
    background: none;
    border: none;
    color: white;
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.header-search-btn:hover { background: rgba(255,255,255,0.18); }
.search-overlay {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1500;
}
.search-panel {
    background: var(--hbl-white);
    max-width: 520px;
    margin: 0 auto;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-3);
    /* O painel NAO rola (quem rola e .search-results-scroll, abaixo). Com
       overflow no painel, o anel de foco do campo — 3px de traco + 2px de
       offset — era cortado nas laterais e no topo, mesmo com padding: o
       overflow em um eixo transforma o outro em auto e clipa junto. Medido
       no browser: precisava de 4px de folga e tinha 3px.
       Nao troque o anel por outline: none — a Fase 1 gastou uma revisao
       inteira para colocá-lo. */
    padding: 6px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--header-h) - 40px);
}
.search-results-scroll {
    overflow-y: auto;
    max-height: calc(100vh - var(--header-h) - 120px);
}
.search-panel-input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    border: none;
    border-bottom: 2px solid var(--border-light);
    font-size: 16px;
    background: var(--hbl-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") 14px center no-repeat;
    border-radius: var(--radius) var(--radius) 0 0;
}
.search-panel-input:focus { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-bottom-color: var(--hbl-green); }
.search-result-group {
    padding: 8px 16px 4px;
    font-size: var(--text-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--hbl-gray);
}
.search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.1s;
    text-decoration: none;
    color: var(--hbl-dark);
}
.search-result-item:hover { background: var(--hbl-green-light); }
.search-result-icon { font-size: 20px; flex-shrink: 0; width: 28px; text-align: center; }
.search-result-info { flex: 1; min-width: 0; }
.search-result-name { font-weight: 600; font-size: 14px; }
.search-result-meta { font-size: var(--text-sm); color: var(--hbl-gray); }
.search-result-action { font-size: var(--text-sm); color: var(--hbl-green-dark); font-weight: 600; flex-shrink: 0; }
.search-loading { text-align: center; padding: 12px; color: var(--hbl-gray); font-size: var(--text-sm); }
.search-empty { padding: 24px 16px; text-align: center; color: var(--hbl-gray); font-size: 14px; }
.search-hint { padding: 16px; text-align: center; color: var(--hbl-gray); font-size: var(--text-sm); }

/* ========== FORM GRID HELPERS ========== */
.form-grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.form-grid-2eq { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* Overrides de <=900px para .action-bar / .pdv-filter-bar / .recipe-composition.
   Ficam aqui (depois das regras base delas, mais acima no arquivo) de proposito:
   especificidade e igual (mesmo seletor simples), entao em empate quem decide e
   a ORDEM NO ARQUIVO — a regra que vem depois vence. Colar isto perto da regra
   base de .pdv-layout (bem no topo do arquivo) faria a base de .action-bar etc.,
   que vem DEPOIS, sobrescrever esse override silenciosamente. */
@media (max-width: 900px) {
    .action-bar {
        /* No breakpoint <=900px, #tab-content e .pdv-layout viram
           overflow: visible (ver regra deles, mais acima) — o scrollport
           do sticky passa a ser a JANELA. A bottom-nav fixa (position:
           fixed; bottom: 0; height: var(--nav-h)) cobriria a barra sem
           este offset. */
        bottom: var(--nav-h);
    }
    /* .pdv-filter-bar (busca do cardapio/bebidas/pacotes) e
       .recipe-composition (resumo da receita nos extras/sabores) tambem
       sao "position: sticky; top: 0" dentro de #tab-content. Com o
       scrollport virando a janela (mesma causa acima), top: 0 delas passa
       a competir com o header (position: sticky; top: 0; z-index: 500)
       pelo mesmo espaco — e o header, com z-index maior, cobre a barra/o
       card. Este offset e o par exato do bottom: var(--nav-h) da
       action-bar, so que pro header fixo no topo em vez da nav fixa
       embaixo. Soma --altura-faixa-offline: #faixa-offline tambem e fixa
       nesta faixa (achado Important da revisao da Fase 2B) — sem somar a
       altura dela aqui, a busca do cardapio ficaria coberta enquanto a
       faixa estivesse visivel. */
    .pdv-filter-bar,
    .recipe-composition {
        top: calc(var(--header-h) + var(--altura-faixa-offline, 0px));
    }
}

/* ========== RESPONSIVE: MOBILE ========== */
/* A pilula de faturamento so cabe inteira em tela larga. Entre 600 e 900px
   ela espremia a marca e quebrava linha; o numero do dia continua no
   Financeiro, agora com ticket medio e comparacao (item 3.3). */
@media (max-width: 900px) {
    .daily-counter { display: none; }
}

@media (max-width: 600px) {
    .payment-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .presets-grid,
    .drinks-grid,
    .package-grid,
    .builder-flavors-grid,
    .addons-grid,
    .flavor-selector-grid {
        /* minmax(0, 1fr), nao 1fr puro: 1fr sozinho tem minimo automatico de
           min-content, entao uma descricao de receita longa (uma unica
           "palavra" sem espaco pro navegador quebrar) forca a coluna a
           esticar alem do container e volta a rolagem lateral. */
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .action-bar {
        flex-direction: column;
        text-align: center;
    }
    .action-bar-info { min-width: auto; }
    .action-bar-buttons { width: 100%; }
    .page-title { font-size: 18px; }
    .chart-grid { grid-template-columns: 1fr; }
    .stock-table, .sales-table { overflow-x: auto; display: block; }
    .stock-table, .sales-table { font-size: var(--text-sm); }
    .stock-table th, .stock-table td,
    .sales-table th, .sales-table td { padding: 6px 4px; }
    .stock-table .hide-mobile,
    .sales-table .hide-mobile { display: none; }
    .modal-content { padding: 16px; }
    .date-filters { flex-direction: row; flex-wrap: wrap; gap: 8px; }
    .date-filters .quick-date-btn { flex: 1 1 auto; }
    .date-filters form { flex: 1 1 100%; flex-wrap: wrap; }
    /* min-width: 0 no input de data: mesmo piso de min-width:auto do
       00e7397 (la em item de grid, aqui em item flex) — sem isso o input
       nao encolhe abaixo do proprio conteudo/tamanho intrinseco e o form
       estoura o container mesmo com flex-wrap: wrap na regra acima. */
    .date-filters form input[type="date"] { flex: 1 1 130px; min-width: 0; }
    .date-filters form button { flex: 1 1 100%; }
    .sugestoes-hide-mobile { display: none; }
    .form-grid-2, .form-grid-2eq, .form-grid-3 { grid-template-columns: 1fr; }
    /* O contador de faturamento nao cabe em 390px (virava bloco de 3 linhas
       vazando sobre as abas); o numero do dia vive no Financeiro. O NOME do
       usuario tambem nao cabe — mas o botao dele agora e a unica porta para
       "Sair", entao vira so o icone em vez de sumir. */
    .daily-counter, .header-user-nome, .header-user::after { display: none; }
    .header-user-icone { display: block; }
    .header-user { min-width: var(--btn-h); min-height: var(--btn-h); justify-content: center; }
    .app-header { padding: 0 12px; }
    .app-header h1 { font-size: 17px; }
    /* O item vira duas linhas: o nome tem a faixa inteira e os controles
       descem. Numa linha so, nome, quantidade, preco e remover disputavam
       331px e o nome ficava com 82px. */
    .cart-item { flex-wrap: wrap; row-gap: var(--space-2); }
    .cart-item-info { flex: 1 1 100%; min-width: 0; }
    .cart-item-price { margin-left: auto; }
    /* Badge de versao e metadado de desenvolvedor, nao informacao do
       operador — sai do celular pra dar mais espaco ao nome da loja antes
       do truncamento (o truncamento em si fica, ver 4bc7b99). */
    .version-badge { display: none; }
}

/* Abaixo de 600px a tabela vira lista de cartoes: cada linha e um bloco e
   cada celula carrega o proprio rotulo. Assim nenhuma coluna precisa ser
   escondida — era escondendo "Porcoes" que a tela de estoque perdia o
   sentido no celular. */
@media (max-width: 600px) {
    .tabela-cartao,
    .tabela-cartao tbody,
    .tabela-cartao tr,
    .tabela-cartao td { display: block; width: auto; }
    .tabela-cartao thead { display: none; }
    .tabela-cartao tr {
        background: var(--surface-2);
        border: 1px solid var(--border-light);
        border-radius: var(--radius-base);
        padding: var(--space-2);
        margin-bottom: var(--space-2);
    }
    .tabela-cartao td {
        display: flex;
        justify-content: space-between;
        gap: var(--space-2);
        border: none;
        padding: 4px 0;
        font-size: var(--text-sm);
    }
    .tabela-cartao td::before {
        content: attr(data-rotulo);
        color: var(--text-secondary);
        font-weight: 600;
        flex-shrink: 0;
    }
    .tabela-cartao td:empty { display: none; }

    /* a linha de grupo nao e um registro: continua faixa de titulo */
    .tabela-cartao tr.product-group-header {
        background: none;
        border: none;
        border-radius: 0;
        padding: var(--space-2) 0 4px;
        margin: 0;
    }
    .tabela-cartao tr.product-group-header td { padding: 0; font-weight: 700; }
    .tabela-cartao tr.product-group-header td::before { content: none; }
}

@media (max-width: 600px) {
    /* no celular a tabela vira cartao, entao o layout fixo de colunas sai
       junto — era ele, somado ao colgroup, que empurrava a pagina para
       566px numa janela de 390px */
    .tabela-colunas-fixas { display: block; table-layout: auto; }

    /* col de largura fixa continua reservando espaco mesmo com a celula em
       display:none — neutraliza o colgroup no celular */
    .tabela-cartao colgroup,
    .tabela-cartao col { width: auto; display: none; }

    /* os 4 botoes de acao (Editar/Duplicar/Desativar/Excluir), com 44px de
       altura, precisam quebrar linha para caber no cartao */
    .tabela-cartao td[data-rotulo="Ações"] { flex-wrap: wrap; }
    .tabela-cartao td[data-rotulo="Ações"] .btn { flex: 1 1 45%; }
}

@media (max-width: 380px) {
    .payment-grid { grid-template-columns: repeat(2, 1fr); }
    .summary-cards { grid-template-columns: 1fr; }
}

/* ========== SELETOR DE LOJA ========== */
.loja-selector-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.loja-selector-card {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 20px;
    background: var(--hbl-white);
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-size: 16px;
    text-align: left;
}
.loja-selector-card:hover, .loja-selector-card:focus {
    border-color: var(--hbl-green);
    box-shadow: 0 2px 8px rgba(120,190,32,0.15);
}
.loja-selector-icon {
    font-size: 28px;
    flex-shrink: 0;
}
.loja-selector-name {
    font-weight: 600;
    color: var(--hbl-dark);
}

/* ========== TOOLTIPS ========== */
/* Help icon that shows tooltip on hover/tap — mobile-friendly */
.help-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--border-light);
    color: var(--hbl-gray);
    font-size: var(--text-xs);
    font-weight: 700;
    cursor: help;
    position: relative;
    vertical-align: middle;
    margin-left: 4px;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
}
.help-tip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    /* scale(0) em repouso: opacity:0 sozinho nao tira o balao da
       diagramacao (a caixa de ate 260px continua contribuindo pro
       scrollWidth da pagina). scale(0) zera a caixa transformada. O
       colapso espera o fade terminar (delay no transform) para nao
       encolher o balao enquanto ele ainda esta visivel fechando. */
    transform: translateX(-50%) scale(0);
    background: var(--hbl-dark);
    color: #fff;
    font-size: var(--text-sm);
    font-weight: 400;
    line-height: 1.4;
    padding: 8px 12px;
    border-radius: 8px;
    width: max-content;
    max-width: 260px;
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s, transform 0s 0.15s;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
/* Arrow */
.help-tip::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%) scale(0);
    border: 4px solid transparent;
    border-top-color: var(--hbl-dark);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s, transform 0s 0.15s;
    z-index: 1001;
}
.help-tip:hover::after,
.help-tip:hover::before,
.help-tip:focus::after,
.help-tip:focus::before,
.help-tip.tip-open::after,
.help-tip.tip-open::before {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    transition: opacity 0.15s, transform 0s;
}
/* When near left edge, align left */
.help-tip.tip-left::after {
    left: 0;
    transform: scale(0);
}
.help-tip.tip-left::before {
    left: 8px;
    transform: scale(0);
}
/* When near right edge, align right */
.help-tip.tip-right::after {
    left: auto;
    right: 0;
    transform: scale(0);
}
.help-tip.tip-right::before {
    left: auto;
    right: 8px;
    transform: scale(0);
}
.help-tip.tip-left:hover::after,
.help-tip.tip-left:hover::before,
.help-tip.tip-left:focus::after,
.help-tip.tip-left:focus::before,
.help-tip.tip-left.tip-open::after,
.help-tip.tip-left.tip-open::before {
    transform: scale(1);
}
.help-tip.tip-right:hover::after,
.help-tip.tip-right:hover::before,
.help-tip.tip-right:focus::after,
.help-tip.tip-right:focus::before,
.help-tip.tip-right.tip-open::after,
.help-tip.tip-right.tip-open::before {
    transform: scale(1);
}
/* Tooltip for table headers — smaller inline */
th .help-tip {
    width: 15px;
    height: 15px;
    font-size: var(--text-xs);
}
/* Tooltip inside labels — keep inline */
label .help-tip {
    margin-left: 3px;
}

/* Header: switch store button */
.header-switch-loja {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    opacity: 0.8;
    transition: opacity 0.15s;
}
.header-switch-loja:hover {
    opacity: 1;
}

/* ========== DARK MODE ========== */

/* Theme toggle button */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    line-height: 1;
    opacity: 0.9;
}
.theme-toggle:hover {
    opacity: 1;
}
/* Quem decide o icone do tema e o CSS, nao o JS: o atributo data-theme ja
   esta no <html> antes da primeira pintura (script anti-FOUC no head), entao
   nao ha janela para o icone errado aparecer. */
.icone-tema-escuro { display: none; }

/* Dark mode variable overrides — explicit toggle */
:root[data-theme="dark"] {
    --alerta-catalogo-texto: #ff9d9d;
    --alerta-catalogo-bg: #4a1f24;
    --hbl-green-dark: #8ed44a;
    --hbl-green-light: #2a4a15;
    --hbl-dark: #e8e8e8;
    --hbl-gray: #a0a0b0;
    --hbl-gray-light: #1a1a2e;
    --hbl-white: #252540;
    --hbl-danger-light: #3a1520;
    --hbl-orange-light: #3a2a15;
    --hbl-warning-bg: #3a3520;
    --hbl-warning-text: #ffc107;
    --hbl-disabled-bg: #3a3a5a;
    --hbl-disabled-text: #6a6a8a;
    --border-light: #3a3a5a;
    --border-subtle: #2a2a4a;
    --border-form: #4a4a6a;
    --bg-hover: #2d2d4a;
    --bg-remove: #3a1520;
    /* Escala de elevação em dark mode: mais densa que light (fundo escuro
       absorve sombra suave). */
    --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-3: 0 12px 32px rgba(0, 0, 0, 0.6);
    /* Variante ascendente (ver comentário no :root claro) — mesma opacidade
       de --shadow-2 acima, só o sinal do offset-Y muda. */
    --shadow-up-2: 0 -4px 12px rgba(0, 0, 0, 0.5);
    /* #4a7d0c (--hbl-green-btn) contra o card escuro (--hbl-white: #252540)
       da so 2.98:1 — abaixo do minimo 3:1 do WCAG 1.4.11. #a5d65e (verde
       claro do ramp) da 8.73:1 sobre o card escuro e 10.06:1 sobre a pagina
       escura (--hbl-gray-light: #1a1a2e). */
    --focus-ring: #a5d65e;

    /* Par escuro da camada semantica (ver comentario no :root claro). */
    --surface-1: #13141c;
    --surface-2: #252540;
    --surface-3: #2d2d4a;
    --text-primary: #e8e8e8;
    --text-secondary: #a8abb8;
    --text-muted: #989cab;

    /* Par escuro da conferencia de caixa (sobre --surface-2 #252540). */
    --verde-texto: #8ed44a;   /* 8.231:1 */
    --caixa-sobra: #ffc107;   /* 9.090:1 */
    --caixa-falta: #ff8b93;   /* 6.608:1 */
}

/* Dark mode component overrides */
:root[data-theme="dark"] .app-header {
    background: linear-gradient(135deg, var(--hbl-green-light), #1a3a0a);
}
:root[data-theme="dark"] .form-control,
:root[data-theme="dark"] .form-control:focus {
    background: var(--bg-hover);
    color: var(--hbl-dark);
    border-color: var(--border-form);
}
:root[data-theme="dark"] .modal-overlay {
    background: rgba(0,0,0,0.7);
}
:root[data-theme="dark"] .modal-content {
    background: var(--hbl-white);
    color: var(--hbl-dark);
}
:root[data-theme="dark"] .cart-container {
    background: var(--surface-2);
}
:root[data-theme="dark"] .cart-item {
    border-color: var(--border-light);
}
:root[data-theme="dark"] .login-body {
    background: var(--hbl-gray-light);
}
:root[data-theme="dark"] .login-card {
    background: var(--hbl-white);
    color: var(--hbl-dark);
}
:root[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, var(--bg-hover) 25%, var(--border-light) 50%, var(--bg-hover) 75%);
}
:root[data-theme="dark"] .toast {
    color: var(--hbl-dark);
}
:root[data-theme="dark"] .toast-success {
    background: #1a3a0a;
}
:root[data-theme="dark"] .toast-error {
    background: var(--hbl-danger-light);
}
:root[data-theme="dark"] .toast-info {
    background: #1a2a3a;
}
:root[data-theme="dark"] .bottom-nav {
    background: var(--hbl-white);
    border-color: var(--border-light);
}
:root[data-theme="dark"] .nav-item.active {
    color: var(--hbl-green);
}
:root[data-theme="dark"] .pay-btn {
    background: var(--bg-hover);
    color: var(--hbl-dark);
    border-color: var(--border-light);
}
:root[data-theme="dark"] .pay-btn.active {
    background: var(--hbl-green);
    color: white;
    border-color: var(--hbl-green);
}
:root[data-theme="dark"] select.form-control {
    background: var(--bg-hover);
    color: var(--hbl-dark);
}
:root[data-theme="dark"] .icone-tema-claro { display: none; }
:root[data-theme="dark"] .icone-tema-escuro { display: inline-block; }
:root[data-theme="dark"] .search-panel {
    background: var(--hbl-white);
}
:root[data-theme="dark"] .search-panel-input {
    background: var(--bg-hover);
    color: var(--hbl-dark);
    border-color: var(--border-form);
}
:root[data-theme="dark"] .daily-counter {
    background: rgba(0,0,0,0.3);
}
:root[data-theme="dark"] .help-tip::after {
    background: var(--border-light);
    color: #fff;
}
:root[data-theme="dark"] .help-tip::before {
    border-top-color: var(--border-light);
}
:root[data-theme="dark"] .pdv-search-input {
    background: var(--bg-hover) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23a0a0b0' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") 12px center no-repeat;
    color: var(--hbl-dark);
    border-color: var(--border-form);
}
:root[data-theme="dark"] .date-filters input[type="date"] {
    background: var(--bg-hover);
    color: var(--hbl-dark);
    border-color: var(--border-form);
    color-scheme: dark;
}
:root[data-theme="dark"] .quick-date-btn {
    color: var(--hbl-dark);
}
:root[data-theme="dark"] .stock-table th,
:root[data-theme="dark"] .sales-table th {
    color: var(--hbl-dark);
}
:root[data-theme="dark"] .loja-selector-card {
    color: var(--hbl-dark);
}
:root[data-theme="dark"] .breadcrumb a {
    color: var(--hbl-green);
}

/* ========== ACESSIBILIDADE: TEXTO SÓ PARA LEITOR DE TELA ========== */
/* Região #anuncio-status (base.html): existe desde o carregamento da página
   para o leitor de tela associá-la, mas fica visualmente oculta. */
.sr-apenas {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ========== ACESSIBILIDADE: REDUZIR MOVIMENTO ========== */
/* Respeita a preferência do sistema do usuário por menos animação/movimento.
   Neutraliza shimmer, spin, slideIn, pulse-offline, transitions e scale em
   elementos interativos. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    /* Desabilita o "scale" de toque/hover nos botões e cards interativos */
    .btn:active,
    .preset-btn:active,
    .flavor-btn:active,
    .addon-btn:active,
    .drink-btn:active,
    .package-btn:active,
    .flavor-select-btn:active,
    .category-chip:active,
    .emoji-btn:active,
    .btn-move:active,
    .builder-remove-btn:hover,
    .builder-remove-btn:active,
    .emoji-btn.emoji-selected,
    .flavor-selected {
        transform: none !important;
    }
}

/* No celular a linha de acoes (agora com 4 botoes, incluindo a estrela do
   Combo do Dia) espremia o nome da receita a uma palavra por linha: o card
   passa a empilhar informacao e acoes. */
@media (max-width: 600px) {
    .lista-receitas .client-card { flex-wrap: wrap; }
    .lista-receitas .client-card > div:first-child { flex: 1 1 100%; }
    .acoes-receita { width: 100%; margin-top: var(--space-2); }
    /* dois por linha: cada acao mantem os 44px de alvo sem virar uma coluna
       de botoes gigantes */
    .acoes-receita > form, .acoes-receita > .btn { flex: 1 1 45%; }
    .acoes-receita > form .btn { width: 100%; }
}
