:root {
    --verde: #1a6b3c;
    --verde2: #2d9b5a;
    --neon: #4ade80;
    --escuro: #0a1a0c;
    --card: rgba(255, 255, 255, 0.05);
    --borda: rgba(255, 255, 255, 0.1);
    --cinza: #8a9a8d;
    --branco: #f0f7f1;
    --vermelho: #ef4444;
    --amarelo: #f59e0b;
    --azul: #3b82f6;
}

.ui-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    flex: 0 0 auto;
    stroke-width: 1.8;
}

.tab-icon {
    display: none;
}

/* ── TELA DE LOGIN ── */
#login-screen {
    position: fixed;
    inset: 0;
    background: var(--escuro);
    background-image:
        radial-gradient(ellipse at 20% 20%, rgba(26, 107, 60, 0.35) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 80%, rgba(45, 155, 90, 0.18) 0%, transparent 55%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    flex-direction: column;
}

#login-screen.hidden {
    display: none;
}

.login-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(74, 222, 128, 0.25);
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 0 60px rgba(26, 107, 60, 0.3);
    backdrop-filter: blur(20px);
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    justify-content: center;
}

.login-logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--verde), var(--verde2));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.login-logo h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--branco);
}

.login-logo p {
    font-size: 12px;
    color: var(--cinza);
}

.login-title {
    font-size: 14px;
    color: var(--cinza);
    text-align: center;
    margin-bottom: 28px;
    letter-spacing: 0.5px;
}

.login-field {
    margin-bottom: 16px;
}

.login-field label {
    display: block;
    font-size: 12px;
    color: var(--cinza);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-field input {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid var(--borda);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--branco);
    font-size: 15px;
    font-family: 'DM Sans', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

.login-field input:focus {
    border-color: var(--neon);
    background: rgba(74, 222, 128, 0.05);
}

.login-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--verde), var(--verde2));
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity 0.2s, transform 0.1s;
    font-family: 'DM Sans', sans-serif;
}

.login-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.login-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #ef4444;
    font-size: 13px;
    padding: 10px 14px;
    margin-top: 12px;
    display: none;
    text-align: center;
}

.login-error.show {
    display: block;
}

.login-security {
    margin-top: 20px;
    text-align: center;
    font-size: 11px;
    color: var(--cinza);
}

.btn-esqueci {
    background: none;
    border: none;
    color: var(--neon);
    font-size: 13px;
    cursor: pointer;
    margin-top: 12px;
    width: 100%;
    text-align: center;
    font-family: 'DM Sans', sans-serif;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.btn-esqueci:hover {
    opacity: 1;
    text-decoration: underline;
}

.login-success {
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.3);
    border-radius: 8px;
    color: var(--neon);
    font-size: 13px;
    padding: 10px 14px;
    margin-top: 12px;
    display: none;
    text-align: center;
}

.login-success.show {
    display: block;
}

/* Botão de logout no header */
.btn-logout {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #ef4444;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: background 0.2s;
    margin-left: 12px;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.22);
}

.user-badge {
    font-size: 12px;
    color: var(--neon);
    margin-left: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    background: var(--escuro);
    color: var(--branco);
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse at 15% 15%, rgba(26, 107, 60, 0.25) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 85%, rgba(45, 155, 90, 0.12) 0%, transparent 55%);
}

#loading {
    position: fixed;
    inset: 0;
    background: rgba(10, 26, 12, 0.97);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
}

#loading .spin {
    width: 48px;
    height: 48px;
    border: 4px solid var(--borda);
    border-top-color: var(--neon);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.strong {
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    font-size: 16px;
}

#loading p {
    color: var(--cinza);
    font-size: 14px;
}

header {
    background: rgba(10, 26, 12, 0.96);
    border-bottom: 1.5px solid var(--verde);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 200;
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-menu-wrap {
    position: relative;
}

.logo-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    overflow: hidden;
    background: linear-gradient(135deg, var(--verde), var(--verde2));
    border: none;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    box-shadow: 0 10px 26px rgba(16, 185, 129, 0.18);
}

.logo-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.logo-menu {
    position: absolute;
    left: 0;
    top: calc(100% + 10px);
    min-width: 180px;
    display: none;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--borda);
    border-radius: 12px;
    background: rgba(10, 26, 12, 0.96);
    box-shadow: 0 18px 32px rgba(0,0,0,.35);
    z-index: 260;
}

.logo-menu.open {
    display: flex;
}

.logo-menu .tab {
    width: 100%;
    text-align: left;
    border-radius: 8px;
    background: rgba(255,255,255,.04);
    padding: 10px 12px;
}

.logo-menu .tab:not(.active):hover {
    background: rgba(255,255,255,.08);
}

.logo h1 {
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    font-size: 17px;
    font-weight: 800;
    line-height: 1;
}

.logo p {
    font-size: 10px;
    color: var(--neon);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-top: 2px;
}

.header-right {
    font-size: 12px;
    color: var(--cinza);
    text-align: right;
}

.header-right strong {
    color: var(--neon);
    display: block;
    font-size: 13px;
}

.sync-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--neon);
    margin-right: 5px;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: 0.3
    }
}

nav {
    display: flex;
    gap: 2px;
    padding: 16px 28px 0;
    background: rgba(10, 26, 12, 0.5);
    border-bottom: 1px solid var(--borda);
    overflow-x: auto;
}

.tab {
    padding: 9px 18px;
    border: none;
    border-radius: 8px 8px 0 0;
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.04);
    color: var(--cinza);
    transition: all .2s;
    white-space: nowrap;
}

/* desktop: mostra só o texto completo, esconde ícone separado e label curto */
.tab::before {
    display: none;
}

.tab .tab-label {
    display: none;
}

.tab .tab-text {
    display: inline;
}

.tab.active {
    background: var(--verde);
    color: #fff;
}

.tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
}

.content {
    padding: 24px 28px;
    max-width: 1080px;
    margin: 0 auto;
}

.panel {
    display: none;
}

.panel.active {
    display: block;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.card {
    background: var(--card);
    border: 1px solid var(--borda);
    border-radius: 14px;
    padding: 18px;
    transition: transform .2s;
}

.card:hover {
    transform: translateY(-2px);
}

.card-label {
    font-size: 10px;
    color: var(--cinza);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 7px;
}

.card-val {
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    font-size: 26px;
    font-weight: 800;
    color: var(--neon);
}

.card-sub {
    font-size: 11px;
    color: var(--cinza);
    margin-top: 3px;
}

.box {
    background: var(--card);
    border: 1px solid var(--borda);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
}

.box h2 {
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--neon);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fg {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.fg label {
    font-size: 11px;
    font-weight: 600;
    color: var(--cinza);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.fg input,
.fg select,
.fg textarea {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--borda);
    border-radius: 8px;
    padding: 10px 13px;
    color: var(--branco);
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color .2s;
    width: 100%;
}

.fg input:focus,
.fg select:focus,
.fg textarea:focus {
    border-color: var(--verde2);
}

.fg select option {
    background: #0d2010;
}

.fg textarea {
    resize: vertical;
    min-height: 70px;
}

.fgrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.btn {
    padding: 11px 24px;
    border: none;
    border-radius: 9px;
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--verde), var(--verde2));
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(26, 107, 60, .4);
}

.btn-danger {
    background: var(--vermelho);
    color: #fff;
}

.btn-warn {
    background: var(--amarelo);
    color: #000;
}

.btn-info {
    background: var(--azul);
    color: #fff;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--borda);
    color: var(--branco);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.13);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 7px;
}

.btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.tbl-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--borda);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: rgba(26, 107, 60, .4);
    padding: 11px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--neon);
}

tbody tr {
    border-bottom: 1px solid var(--borda);
    transition: background .15s;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

tbody td {
    padding: 11px 14px;
    font-size: 13px;
}

.badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.badge-ok {
    background: rgba(74, 222, 128, .15);
    color: var(--neon);
    border: 1px solid rgba(74, 222, 128, .3);
}

.badge-cancel {
    background: rgba(239, 68, 68, .15);
    color: var(--vermelho);
    border: 1px solid rgba(239, 68, 68, .3);
}

.prog-bar {
    background: rgba(255, 255, 255, .1);
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
    margin: 8px 0;
}

.prog-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--verde), var(--neon));
    transition: width .5s;
}

.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.day-card {
    background: var(--card);
    border: 1px solid var(--borda);
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
}

.day-name {
    font-size: 10px;
    color: var(--cinza);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 4px;
}

.day-val {
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--neon);
}

.day-card.today {
    border-color: var(--verde2);
    background: rgba(45, 155, 90, .12);
}

.modal-bg {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .75);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-bg.open {
    display: flex;
}

.modal {
    background: #0e2011;
    border: 1.5px solid var(--verde);
    border-radius: 18px;
    padding: 28px;
    max-width: 480px;
    width: 100%;
    animation: pop .2s ease;
}

@keyframes pop {
    from {
        transform: scale(.92);
        opacity: 0
    }

    to {
        transform: scale(1);
        opacity: 1
    }
}

.modal h3 {
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 8px;
}

.modal p {
    color: var(--cinza);
    font-size: 13px;
    margin-bottom: 18px;
    line-height: 1.6;
}

.modal-detail {
    background: rgba(255, 255, 255, .05);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 18px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.modal-detail p {
    margin: 4px 0;
    color: var(--branco);
    font-size: 14px;
}

.modal-detail p span {
    color: var(--neon);
    font-weight: 600;
}

.toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: #0e2011;
    border: 1.5px solid var(--verde);
    border-radius: 12px;
    padding: 14px 20px;
    font-size: 14px;
    z-index: 999;
    transform: translateY(80px);
    opacity: 0;
    transition: all .35s;
    max-width: 320px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.err {
    border-color: var(--vermelho);
}

.toast.warn {
    border-color: var(--amarelo);
}

.meta-box {
    background: rgba(74, 222, 128, .06);
    border: 1px solid rgba(74, 222, 128, .2);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.meta-box p {
    font-size: 13px;
    color: var(--cinza);
    margin-top: 4px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.sec-title {
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sec-title span {
    color: var(--neon);
}

/* ── NOTA FISCAL ── */
#modal-nf-bg .modal {
    background: #0e2011;
    max-width: 580px;
}

#nf-corpo {
    background: #fff;
    border-radius: 0 0 16px 16px;
    color: #111;
}

/* Botão info (azul) */
.btn-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid #3b82f6;
    color: #93c5fd;
}

.btn-info:hover {
    background: rgba(59, 130, 246, 0.28);
}

@media print {
    body * { visibility: hidden; }
    #nf-print, #nf-print * { visibility: visible; }
    #nf-print { position: fixed; left: 0; top: 0; width: 100%; padding: 20px; }
}

/* ── GRADE DE PRODUTOS (aba Venda) ── */
.grade-produtos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.prod-card {
    background: rgba(255,255,255,0.04);
    border: 1.5px solid var(--borda);
    border-radius: 14px;
    padding: 16px 12px;
    cursor: pointer;
    text-align: center;
    transition: border-color .2s, background .2s, transform .15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.prod-card:hover {
    border-color: var(--verde);
    background: rgba(74,222,128,0.07);
}

.prod-card.selected {
    border-color: var(--neon);
    background: rgba(74,222,128,0.13);
    transform: scale(1.03);
    box-shadow: 0 0 14px rgba(74,222,128,0.25);
}

.prod-card .pc-icon {
    width: 28px;
    height: 28px;
    line-height: 1;
}

.prod-card .pc-nome {
    font-size: 13px;
    font-weight: 700;
    color: var(--branco);
    line-height: 1.3;
}

.prod-card .pc-tipo {
    font-size: 10px;
    color: var(--cinza);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.prod-card .pc-preco {
    font-size: 15px;
    font-weight: 800;
    color: var(--neon);
    margin-top: 4px;
}

.prod-card .pc-badge {
    font-size: 10px;
    background: rgba(74,222,128,0.15);
    color: var(--verde);
    border-radius: 20px;
    padding: 2px 8px;
    margin-top: 2px;
}

/* Banner do produto selecionado */
.produto-banner {
    background: rgba(74,222,128,0.1);
    border: 1.5px solid var(--verde);
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.produto-banner .pb-icon { font-size: 32px; }
.produto-banner .pb-info { flex: 1; min-width: 120px; }
.produto-banner .pb-nome { font-size: 16px; font-weight: 700; color: var(--branco); }
.produto-banner .pb-sub  { font-size: 12px; color: var(--cinza); margin-top: 2px; }
.produto-banner .pb-preco { font-size: 20px; font-weight: 800; color: var(--neon); }

@media(max-width:600px) {
    .grade-produtos {
        grid-template-columns: repeat(2, 1fr);
    }
    .produto-banner { padding: 12px 14px; gap: 10px; }
    .produto-banner .pb-icon { font-size: 26px; }
    .produto-banner .pb-preco { font-size: 17px; }
}

@media(max-width:600px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .week-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .content {
        padding: 16px;
        /* espaço extra no fundo para a nav não cobrir o conteúdo */
        padding-bottom: 90px;
    }

    /* ── NAV BOTTOM BAR (mobile) ── */
    nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;                          /* desconecta do topo */
        z-index: 300;
        display: flex;
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        gap: 0;
        padding: 0;
        border-bottom: none;
        border-top: 1.5px solid var(--verde);
        background: rgba(10, 26, 12, 0.97);
        -webkit-backdrop-filter: blur(16px);
        backdrop-filter: blur(16px);
        overflow-x: visible;
        height: 64px;
    }

    .tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 6px 4px;
        border-radius: 0;
        font-size: 9.5px;
        font-weight: 600;
        letter-spacing: 0.3px;
        background: transparent;
        color: var(--cinza);
        border: none;
        height: 100%;
        white-space: nowrap;
        text-transform: uppercase;
    }

    /* Mobile uses explicit SVG icons and short labels. */
    .tab .tab-text {
        display: none;
    }

    .tab .tab-icon {
        display: block;
        width: 22px;
        height: 22px;
    }

    .tab .tab-label {
        font-size: 9px;
        display: block;
        letter-spacing: 0.2px;
    }

    .tab.active {
        color: var(--neon);
        background: transparent;
    }

    .tab.active .tab-icon {
        filter: drop-shadow(0 0 6px rgba(74,222,128,0.7));
    }

    .tab:hover:not(.active) {
        background: transparent;
        color: var(--branco);
    }
}

/* ── LAYOUT DA ABA VENDA (catálogo + carrinho lado a lado) ── */
.venda-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.venda-col-prod,
.venda-col-cart {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

/* Grade de produtos — 2 colunas dentro da coluna esquerda */
.grade-produtos {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* ── CARRINHO ── */
.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 10px 0;
    border-bottom: 1px solid var(--borda);
}

.cart-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.cart-info {
    flex: 1;
    min-width: 0;
}

.cart-nome {
    font-size: 13px;
    font-weight: 600;
    color: var(--branco);
    white-space: normal;
    overflow-wrap: anywhere;
}

.cart-preco {
    font-size: 12px;
    color: var(--cinza);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.cart-unit-input {
    width: 64px;
    padding: 2px 6px;
    background: rgba(255,255,255,.07);
    border: 1px solid var(--borda);
    border-radius: 6px;
    color: var(--branco);
    font-size: 12px;
    font-family: inherit;
    outline: none;
}

.cart-qty {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.qty-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--borda);
    background: rgba(255,255,255,.07);
    color: var(--branco);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}

.qty-btn:hover { background: var(--verde); }

.cart-sub {
    font-size: 14px;
    font-weight: 700;
    color: var(--neon);
    flex-shrink: 0;
    min-width: 70px;
    text-align: right;
}

.cart-rem {
    background: none;
    border: none;
    color: var(--cinza);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color .15s;
}

.cart-rem:hover { color: var(--vermelho); }

/* ── PRÉ-DEFINIDOS: Lista de produtos ── */
.lista-predefinidos {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.predef-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--borda);
    border-radius: 12px;
    padding: 12px 16px;
    transition: border-color .2s;
}

.predef-item:hover { border-color: var(--verde); }

.predef-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.predef-info {
    flex: 1;
    min-width: 0;
}

.predef-nome {
    font-size: 14px;
    font-weight: 700;
    color: var(--branco);
}

.predef-sub {
    font-size: 12px;
    color: var(--cinza);
    margin-top: 3px;
}

.predef-acoes {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ── RESPONSIVO: mobile (1 coluna) ── */
@media(max-width:768px) {
    .venda-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .grade-produtos {
        grid-template-columns: repeat(2, 1fr);
    }

    header {
        padding: 12px 16px;
    }

    .logo {
        gap: 10px;
    }

    .logo h1 {
        font-size: 15px;
    }

    .logo p {
        letter-spacing: 0.8px;
    }

    .header-right {
        display: none;
    }

    nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 200;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        background: rgba(10, 26, 12, 0.96);
        border-top: 1px solid var(--borda);
        border-bottom: none;
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
    }

    .tab {
        display: none;
        border-radius: 12px;
        padding: 10px 8px;
        min-height: 52px;
    }

    .tab.mobile-fixed {
        display: flex;
        flex-direction: column;
        gap: 3px;
        align-items: center;
        justify-content: center;
    }

    .tab.mobile-fixed .tab-icon {
        display: block;
        width: 20px;
        height: 20px;
    }

    .tab .tab-label {
        display: inline;
        font-size: 12px;
        font-weight: 700;
    }

    .tab .tab-text {
        display: none;
    }

    .logo-menu .tab {
        display: flex;
        width: 100%;
        justify-content: flex-start;
        padding: 10px 12px;
    }

    .logo-menu .tab .tab-label {
        display: inline;
    }

    .logo-menu .tab .tab-text {
        display: inline;
    }

    .content {
        padding: 20px 16px 110px;
    }

    .logo-menu {
        width: 210px;
    }
}

/* ── GASTOS VARIÁVEIS ── */
.gasto-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--borda);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 8px;
    transition: border-color .2s;
}

.gasto-item:hover { border-color: rgba(239, 68, 68, 0.4); }

.gasto-info {
    flex: 1;
    min-width: 0;
}

.gasto-nome {
    font-size: 14px;
    font-weight: 700;
    color: var(--branco);
}

.gasto-sub {
    font-size: 12px;
    color: var(--cinza);
    margin-top: 3px;
}

.gasto-valor {
    font-size: 15px;
    font-weight: 800;
    color: var(--vermelho);
    flex-shrink: 0;
    min-width: 80px;
    text-align: right;
}

/* ── AJUSTES RESPONSIVOS ── */
@media (max-width: 1024px) {
    .content {
        padding-left: 20px;
        padding-right: 20px;
    }

    header {
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (max-width: 768px) {
    header {
        gap: 12px;
    }

    .header-right {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
        font-size: 0;
    }

    .header-right strong,
    .header-right .user-badge {
        display: none;
    }

    .btn-logout {
        margin-left: 0;
        padding: 8px 10px;
        white-space: nowrap;
    }

    .content {
        width: 100%;
        padding: 18px 16px calc(92px + env(safe-area-inset-bottom));
    }

    .box {
        padding: 18px;
    }

    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .card {
        padding: 14px;
        min-width: 0;
    }

    .card-val {
        font-size: clamp(20px, 5vw, 26px);
        overflow-wrap: anywhere;
    }

    .fgrid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .venda-layout,
    .venda-col-prod,
    .venda-col-cart {
        min-width: 0;
    }

    .tbl-wrap {
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    .tbl-wrap table {
        min-width: 640px;
    }

    .week-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .modal-bg {
        padding: 12px;
        align-items: flex-start;
        overflow-y: auto;
    }

    .modal {
        margin: auto 0;
        max-height: calc(100dvh - 24px);
        overflow-y: auto;
        padding: 22px;
    }

    #modal-nf-bg .modal {
        overflow-y: hidden;
    }

    #modal-nf-bg .modal > div:first-child {
        flex-wrap: wrap;
        padding: 14px 16px;
    }

    #nf-corpo {
        max-height: calc(100dvh - 112px) !important;
        padding: 16px !important;
    }

    .toast {
        right: 12px;
        bottom: calc(78px + env(safe-area-inset-bottom));
        left: 12px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .login-box {
        width: calc(100% - 32px);
        padding: 32px 24px;
    }

    header {
        padding: 10px 12px;
    }

    .logo {
        gap: 8px;
        min-width: 0;
    }

    .logo-icon {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
    }

    .logo h1 {
        font-size: 14px;
    }

    .logo p {
        font-size: 9px;
    }

    .header-right {
        flex: 0 0 auto;
    }

    .btn-logout {
        padding: 8px;
        font-size: 0;
    }

    .btn-logout .ui-icon {
        width: 18px;
        height: 18px;
    }

    .content {
        padding: 16px 12px calc(88px + env(safe-area-inset-bottom));
    }

    .sec-title {
        font-size: 20px;
    }

    .box {
        padding: 14px;
        border-radius: 12px;
    }

    .box h2 {
        font-size: 15px;
    }

    .cards {
        grid-template-columns: minmax(0, 1fr);
    }

    .fgrid {
        grid-template-columns: minmax(0, 1fr);
    }

    .grade-produtos {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .prod-card {
        padding: 14px 8px;
    }

    .cart-item {
        gap: 7px;
        flex-wrap: wrap;
    }

    .cart-info {
        flex-basis: calc(100% - 40px);
    }

    .cart-qty {
        margin-left: 31px;
    }

    .week-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    nav {
        gap: 4px;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    }

    .tab.mobile-fixed {
        min-width: 0;
        padding: 8px 4px;
    }

    .tab .tab-label {
        font-size: 10px;
    }

    .btn-row > .btn {
        flex: 1 1 auto;
        justify-content: center;
    }

    #modal-nf-bg .btn-row > .btn {
        flex: 0 0 auto;
    }
}