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

/*
  PDV Lanchonete - app.css (refatorado)
  - CSS puro (sem nesting)
  - Paleta mais viva baseada na logo (laranja/vermelho/amarelo/verde)
  - Mantém classes/IDs já usados nas telas
*/

:root {
    --bg-0: #fff7ed;
    /* base clara */
    --bg-1: #ffedd5;
    /* laranja bem claro */
    --bg-2: #dcfce7;
    /* verde claro */
    --ink: #111827;
    --muted: #475569;
    --muted-2: #64748b;

    --card: #ffffff;
    --card-2: #fffaf2;
    --line: rgba(15, 23, 42, .12);
    --shadow: 0 18px 50px rgba(2, 6, 23, .18);

    --brand: #f97316;
    /* laranja */
    --brand-2: #ef4444;
    /* vermelho */
    --brand-3: #facc15;
    /* amarelo */
    --brand-4: #22c55e;
    /* verde */
    --brand-5: #fb7185;
    /* rosa */

    --btn: #111827;
    --btnText: #fff;

    --radius: 18px;
    --radius-sm: 12px;

    --vk-safe: 0px;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(900px 600px at 15% 15%, rgba(249, 115, 22, .25), transparent 60%),
        radial-gradient(900px 600px at 85% 20%, rgba(250, 204, 21, .18), transparent 60%),
        linear-gradient(135deg, var(--bg-0), var(--bg-1));
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: url("../img/icone.png") center / cover no-repeat;
    opacity: 0.12;
    /* 👈 controla aqui */
    pointer-events: none;
    z-index: -1;
}

/* Layout base */
.wrap {
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.card {
    width: 100%;
    max-width: 420px;
    background: linear-gradient(180deg, var(--card), var(--card-2));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px 26px;
    position: relative;
    overflow: hidden;
    animation: fadeIn .25s ease;
}

/* detalhe colorido no topo do card */
.card::before {
    content: "";
    position: absolute;
    top: -120px;
    right: -140px;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle at 30% 30%, rgba(249, 115, 22, .45), rgba(239, 68, 68, .25), transparent 70%);
    filter: blur(10px);
}

h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.02em;
    text-align: center;
}

.subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--muted);
    margin-top: 6px;
    margin-bottom: 22px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 800;
    color: var(--muted);
}

input,
select {
    width: 100%;
    padding: 13px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(15, 23, 42, .14);
    background: #fff;
    color: var(--ink);
    font-size: 14px;
    transition: .15s;
}

input {
    margin-bottom: 16px;
}

input:focus,
select:focus {
    outline: none;
    border-color: rgba(249, 115, 22, .55);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, .18);
}

/* botões */
button {
    width: 100%;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: none;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    font-weight: 900;
    font-size: 14px;
    cursor: pointer;
    transition: .15s;
    box-shadow: 0 10px 18px rgba(239, 68, 68, .18);
    z-index: 1
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0px) scale(.99);
}

button:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.msg {
    margin-top: 12px;
    text-align: center;
    font-size: 13px;
    min-height: 18px;
}

.footer {
    margin-top: 22px;
    text-align: center;
    font-size: 11px;
    color: var(--muted-2);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

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

/* Utilitários */
.row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    z-index: 1;
}

.right {
    text-align: right;
}

.center {
    text-align: center;
}

.small {
    font-size: 12px;
}

.panel {
    background: rgba(255, 255, 255, .72);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 12px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.topbar>div:nth-child(1) {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 50px;
}

.topbar img {
    width: 100px;
    margin: -25px -20px -14px;
}

.chip {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .75);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

/* btn2: botões menores da barra */
.btn2 {
    width: auto;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, .10);
    background: linear-gradient(135deg, rgba(250, 204, 21, .92), rgba(249, 115, 22, .92));
    color: #2b1200;
    font-weight: 900;
    box-shadow: 0 10px 18px rgba(249, 115, 22, .16);
}

.btn2:hover {
    transform: translateY(-1px);
}

.btnDanger {
    background: linear-gradient(135deg, rgba(15, 23, 42, .92), rgba(51, 65, 85, .92));
    color: #fff;
    border-color: rgba(15, 23, 42, .18);
    box-shadow: 0 10px 18px rgba(2, 6, 23, .16);
}

.btnSmall {
    width: auto;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, .12);
    background: rgba(255, 255, 255, .85);
    color: var(--ink);
    font-weight: 900;
    cursor: pointer;
    box-shadow: none;
}

.btnSmall:hover {
    transform: translateY(-1px);
}

/* Tabelas */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th,
td {
    padding: 10px;
    border-bottom: 1px solid rgba(15, 23, 42, .10);
    text-align: left;
}

#pdv table tbody tr td:nth-child(2) {
    display: flex;
    align-items: center;
}

th {
    color: var(--muted);
    font-weight: 900;
}

/* Badges (Notas) */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 11px;
    border: 1px solid rgba(15, 23, 42, .10);
    background: rgba(255, 255, 255, .8);
    color: var(--muted);
}

.badge.ok {
    background: rgba(34, 197, 94, .15);
    border-color: rgba(34, 197, 94, .25);
    color: #14532d;
}

.badge.warn {
    background: rgba(250, 204, 21, .18);
    border-color: rgba(250, 204, 21, .30);
    color: #78350f;
}

/* ====== MENU / PDV cards ====== */
.pdv-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

#btnCarrinho {
    display: none;
}

@media (max-width:1200px) {
    .pdv-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width:820px) {
    .pdv-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width:520px) {
    .pdv-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
}

.pdv-card {
    border: 1px solid rgba(15, 23, 42, .10);
    background: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .78));
    border-radius: 18px;
    padding: 14px;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    min-height: 82px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 14px 30px rgba(2, 6, 23, .10);
    position: relative;
    overflow: hidden;
}

.pdv-card::after {
    content: "";
    position: absolute;
    inset: -20px -60px auto auto;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle at 30% 30%, rgba(249, 115, 22, .38), rgba(250, 204, 21, .22), transparent 70%);
}

.pdv-card:active {
    transform: scale(.99);
}

.pdv-card .name {
    font-weight: 1000;
    font-size: 15px;
}

.pdv-card .meta {
    font-size: 12px;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    font-weight: 800;
}

/* chips de categoria no PDV */
.pdv-chip {
    padding: 10px 12px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, .12);
    background: rgba(255, 255, 255, .78);
    color: var(--ink);
    font-weight: 900;
    cursor: pointer;
}

.pdv-chip.active {
    background: linear-gradient(135deg, rgba(34, 197, 94, .95), rgba(250, 204, 21, .55));
    border: 1px solid rgba(34, 197, 94, .28);
    color: #052e16;
}

#cats {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

@media (max-width:600px) {
    #cats {
        flex-wrap: wrap;
    }
}

/* ====== Modal padrão (PDV / Produtos / Categorias / Notas) ====== */
.pdv-modal {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, .55);
    z-index: 15000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.pdv-hide {
    display: none !important;
}

.pdv-modal-card {
    width: min(980px, 96vw);
    background: linear-gradient(180deg, #ffffff, #fff7ed);
    border: 1px solid rgba(15, 23, 42, .12);
    border-radius: 18px;
    padding: 14px;
    box-shadow: 0 28px 80px rgba(2, 6, 23, .35);
}

.pdv-modal-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid rgba(15, 23, 42, .10);
    padding-bottom: 10px;
}

.pdv-modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    border-top: 1px solid rgba(15, 23, 42, .10);
    padding-top: 12px;
    margin-top: 12px;
}

/* grid de denominações (caixa) */
.pdv-denoms {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
}

@media (max-width:900px) {
    .pdv-denoms {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.pdv-denom {
    border: 1px solid rgba(15, 23, 42, .12);
    background: rgba(255, 255, 255, .82);
    border-radius: 16px;
    padding: 10px;
}

.pdv-denom .lbl {
    font-weight: 1000;
}

.pdv-denom input {
    width: 100%;
    margin-top: 8px;
    margin-bottom: 0;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, .14);
    background: #fff;
    color: var(--ink);
    font-size: 16px;
}

/* total do PDV */
.total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    font-weight: 1000;
    font-size: 16px;
}

/* ====== Ajustes por página ====== */
body#pdv .card,
body#menu .card,
body#produtos .card,
body#categorias .card,
body#notas .card {
    max-width: 1100px;
}

body#login .card {
    max-width: 420px;
}

/* ===== Footer institucional (novo) ===== */
.footer__copyright {
    position: fixed;
    bottom: 0;
    width: 90%;
    margin-top: 18px;
    padding: 12px 50px;
    border-top: 1px solid rgba(15, 23, 42, .10);
}

.footer__copyright .row {
    justify-content: space-between;
    align-items: center;
}

.footer__copyright-text p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.footer__copyright-text a {
    color: var(--ink);
    font-weight: 900;
    text-decoration: none;
}

.footer__copyright-text a:hover {
    text-decoration: underline;
}

.footer__copyright-text img {
    height: 18px;
    vertical-align: middle;
    margin-left: 6px;
}

.footer__policy {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.footer__policy a {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.footer__policy a:hover {
    color: var(--ink);
    text-decoration: underline;
}

@media (max-width:760px) {
    .footer__copyright .row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .footer__policy {
        justify-content: flex-start;
    }
}

/* --- Virtual Keyboard (Touch) --- */
.vk-root {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(255, 247, 237, .98));
    border-top: 1px solid rgba(15, 23, 42, .12);
    padding: 10px;
    z-index: 20000;
    box-shadow: 0 -18px 34px rgba(2, 6, 23, .20);
}

.vk-root.vk-hidden {
    display: none !important;
}

.vk-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.vk-title {
    font-weight: 1000;
    color: var(--ink);
}

.vk-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.vk-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vk-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: nowrap;
    overflow-x: hidden;
}

.vk-btn {
    flex: 1;
    min-width: 44px;
    padding: 14px 10px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, .12);
    background: rgba(255, 255, 255, .88);
    color: var(--ink);
    font-weight: 1000;
    font-size: 16px;
    cursor: pointer;
    touch-action: manipulation;
    box-shadow: none;
}

.vk-btn:active {
    transform: scale(.99);
}

.vk-ghost {
    background: rgba(15, 23, 42, .06);
    border-color: rgba(15, 23, 42, .10);
    color: var(--muted);
}

.vk-root.vk-numeric .vk-btn-type,
.vk-root.vk-numeric .vk-btn-shift,
.vk-root.vk-numeric .vk-wide {
    display: none !important;
}

.vk-btn-shift {
    font-size: 13px;
    padding: 14px 5px;
}

.vk-primary {
    background: linear-gradient(135deg, rgba(249, 115, 22, .95), rgba(239, 68, 68, .95));
    border: none;
    color: #fff;
}

.vk-wide {
    flex: 3;
}

.vk-footer {
    display: flex;
    gap: 8px;
}

/* ======== DESKTOP TOUCH (teclado lateral) ======== */
@media (min-width:980px) {
    body.vk-open #loginWrap {
        margin-right: 600px;
    }

    body.vk-open #modalCat {
        margin-right: 600px;
    }

    body.vk-open #modalProd {
        margin-right: 600px;
    }

    /* quando teclado estiver aberto, modal não pode ficar por baixo */
    /* body.vk-open .pdv-modal {
        justify-content: flex-start;
    } */

    body.vk-open .wrap {
        padding-right: var(--vk-safe);
    }

    body#pdv.vk-open.vk-type-alpha .pdv-modal-card {
        margin-right: 560px;
    }

    body#pdv.vk-open.vk-type-numeric .pdv-modal-card {
        margin-right: 390px;
    }

    .vk-root {
        top: 0;
        bottom: 0;
        left: auto;
        right: 0;
        border-top: 0;
        border-left: 1px solid rgba(15, 23, 42, .12);
        padding: 14px;
        box-shadow: -18px 0 34px rgba(2, 6, 23, .18);
    }

    .vk-root.vk-alpha {
        width: 600px;
        height: 45%;
        margin-top: auto;
    }

    .vk-root.vk-numeric {
        width: 350px;
    }

    .vk-root:not(.vk-hidden) {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .vk-root,
    .vk-body {
        overflow-x: hidden;
    }
}

/* ===== MENU GRID COM PDV MAIOR ===== */

#menu .menu-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    grid-auto-rows: 120px;
    gap: 14px;
}

/* PDV ocupa 2 linhas */
#menu .pdv-card-primary {
    grid-row: span 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, rgba(249, 115, 22, .45), rgba(239, 68, 68, .25), transparent 70%);
    border: none;
    box-shadow: 0 22px 50px rgba(255, 90, 0, .30);
}

/* texto do card principal */
#menu .pdv-card-primary .name {
    font-size: 22px;
    font-weight: 900;
    margin-bottom: 10px;
}

#menu .pdv-card-primary .meta {
    font-size: 14px;
    font-weight: 800;
}

/* badge */
#menu .menu-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    background: #fff;
    color: #b91c1c;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 900;
    z-index: 1;
}

/* hover geral */
#menu .pdv-card {
    transition: all .18s ease;
}

#menu .pdv-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 45px rgba(0, 0, 0, .25);
}

/* RESPONSIVO */
@media (max-width: 1100px) {
    #menu .menu-grid {
        grid-template-columns: 1fr 1fr;
    }

    #menu .pdv-card-primary {
        grid-column: span 2;
        grid-row: span 1;
        height: 140px;
    }
}

@media (max-width: 640px) {
    #menu .menu-grid {
        grid-template-columns: 1fr;
    }

    #menu .pdv-card-primary {
        grid-column: span 1;
    }
}

/* ===== ÍCONES MENU ===== */

#menu .menu-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, .08);
}

#menu .menu-icon svg {
    width: 26px;
    height: 26px;
}

/* Card principal ícone maior */
#menu .pdv-card-primary .menu-icon {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, .18);
}

#menu .pdv-card-primary .menu-icon svg {
    width: 32px;
    height: 32px;
}

:root {
    --tap: 54px;
    /* altura mínima touch */
    --radius: 16px;
    --gap: 12px;
}

/* melhora toque */
button,
.pdv-card,
.pdv-chip,
input,
select {
    min-height: var(--tap);
    touch-action: manipulation;
}

/* Layout do PDV */
.pdv-layout {
    display: grid;
    gap: var(--gap);
}

/* 1200px: 2 colunas */
@media (min-width: 1200px) {
    .pdv-layout {
        grid-template-columns: 1.2fr 0.8fr;
        /* vitrine | carrinho */
        align-items: start;
    }

    .pdv-cart {
        position: sticky;
        top: 12px;
        max-height: calc(100vh - 24px - var(--vk-safe, 0px));
        overflow: auto;
    }
}

/* Tablet: 2 colunas menores */
@media (min-width: 768px) and (max-width: 1199px) {
    .pdv-layout {
        grid-template-columns: 1fr 0.9fr;
    }
}

/* Mobile: 1 coluna */
@media (max-width: 767px) {
    .pdv-layout {
        grid-template-columns: 1fr;
    }

    .pdv-cart {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        background: #ffffff;
        border-top: 1px solid rgba(255, 255, 255, .1);
        max-height: 70vh;
        transform: translateY(100%);
        transition: transform .2s ease;
        padding-bottom: calc(12px + var(--vk-safe, 0px));
        width: 95%;
        margin: 0 auto;
    }

    body.cart-open .pdv-cart {
        transform: translateY(0);
    }

    #btnCarrinho {
        display: block;
    }
}

/* Grid de produtos */
.pdv-grid-produtos {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 768px) {
    .pdv-grid-produtos {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .pdv-grid-produtos {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Card grande */
.pdv-card {
    border-radius: var(--radius);
    padding: 14px;
}

.pdv-card .name {
    font-size: 16px;
    font-weight: 900;
}

.pdv-card .meta {
    display: flex;
    justify-content: space-between;
    opacity: .9;
    margin-top: 8px;
}

/* =========================
   PDV Touch + Responsivo
========================= */
:root {
    --tap: 54px;
    --radius: 16px;
    --gap: 12px;
    --vk-safe: 0px;
    /* será controlado via JS */
}

#pdv button,
#pdv input,
#pdv select,
#pdv .pdv-card,
#pdv .pdv-chip {
    min-height: var(--tap);
    touch-action: manipulation;
}

#pdv button{
    min-height: 40px;
    padding: 10px 10px;
}

#pdv .pdv-layout {
    display: grid;
    gap: var(--gap);
    align-items: start;
}

/* 1200px+: vitrine + carrinho lado a lado */
@media (min-width: 1200px) {
    #pdv .pdv-layout {
        grid-template-columns: 1.2fr .8fr;
    }

    #pdv .pdv-cart {
        position: sticky;
        top: 12px;
        max-height: calc(100vh - 24px - var(--vk-safe));
        overflow: auto;
    }

    #btnFecharCarrinho {
        display: none;
    }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1199px) {
    #pdv .pdv-layout {
        grid-template-columns: 1fr .9fr;
    }

    #btnFecharCarrinho {
        display: none;
    }
}

/* Mobile: carrinho vira drawer */
@media (max-width: 767px) {
    #pdv .pdv-layout {
        grid-template-columns: 1fr;
    }

    #pdv .pdv-cart {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 10px;
        z-index: 50;
        max-height: calc(72vh - var(--vk-safe));
        overflow: auto;
        transform: translateY(120%);
        transition: transform .2s ease;
        padding-bottom: calc(12px + var(--vk-safe));
    }

    body#pdv.cart-open .pdv-cart {
        transform: translateY(0);
    }

    #btnFecharCarrinho {
        display: inline-flex;
    }
}

/* Categorias: chips roláveis */
#pdv .pdv-cats {
    display: flex;
    gap: 10px;
    overflow: auto;
    padding-top: 10px;
    -webkit-overflow-scrolling: touch;
}

#pdv .pdv-cats::-webkit-scrollbar {
    height: 8px;
}

/* Grid de produtos: auto responsivo */
#pdv .pdv-grid-produtos {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 768px) {
    #pdv .pdv-grid-produtos {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    #pdv .pdv-grid-produtos {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Produto card (reforça área de toque) */
#pdv .pdv-card {
    border-radius: var(--radius);
    padding: 14px;
}

#pdv .pdv-card .name {
    font-size: 16px;
    font-weight: 900;
}

#pdv .pdv-card .meta {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    color: #94a3b8;
    font-weight: 700;
}

/* Quando teclado virtual abre, dá “respiro” */
body.vk-open #pdvWrap {
    padding-bottom: calc(12px + var(--vk-safe));
}

#pdv .pdv-cart-overlay {
    display: none;
}

@media (max-width: 767px) {
    #pdv .pdv-cart-overlay {
        position: fixed;
        inset: 0;
        background: rgba(2, 6, 23, .45);
        z-index: 49;
        display: block;
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }

    body#pdv.cart-open .pdv-cart-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    #pdv .pdv-cart {
        z-index: 50;
        /* acima do overlay */
    }
}

/* ===== Responsive Stability Fixes ===== */
body#menu,
body#pdv,
body#produtos,
body#categorias,
body#notas {
    align-items: flex-start;
    padding-top: 10px;
    padding-bottom: 24px;
}

.pdv-modal-card {
    max-height: calc(100vh - 32px);
    overflow: auto;
}

@media (max-width: 980px) {
    .wrap {
        padding: 12px;
    }

    .card {
        padding: 18px 14px;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .topbar>div:nth-child(1) {
        gap: 12px;
        flex-wrap: wrap;
    }

    .topbar img {
        width: 72px;
        margin: 0;
    }

    .topbar .row {
        width: 100%;
        justify-content: flex-start;
    }

    .footer__copyright {
        position: static;
        width: 100%;
        padding: 12px 16px;
    }

    body#produtos .panel,
    body#categorias .panel,
    body#notas .panel {
        overflow-x: auto;
    }
}

@media (max-width: 767px) {
    body {
        flex-direction: column;
    }
    body#unidades .card{
        margin-top: 50%;
        margin-bottom: 50%;
    }

    .wrap {
        position: absolute;
        top: 0;
        padding-bottom: 100px;
    }

    th,
    td {
        padding: 8px;
        white-space: nowrap;
    }

    .pdv-modal {
        align-items: flex-end;
        padding: 10px;
    }

    .pdv-modal-card {
        width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 88vh;
    }

    .footer__copyright {
        position: fixed;
        bottom: 0;
    }
}