* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f3f6fb;
    color: #0f172a;
}

a {
    text-decoration: none;
}

.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 34px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.25);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.logo-icon,
.brand-icon {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    background: linear-gradient(135deg, #2563eb, #22c55e);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: bold;
}

.login-logo h1 {
    margin: 12px 0 4px;
    color: #1d4ed8;
    font-size: 34px;
    letter-spacing: 1px;
}

.login-logo p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: bold;
    color: #334155;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    height: 46px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 0 14px;
    font-size: 15px;
    outline: none;
    background: #fff;
}

.form-group textarea {
    height: 100px;
    padding-top: 12px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.btn-login,
.btn-primary,
.btn-danger,
.btn-secondary {
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    display: inline-block;
}

.btn-login {
    width: 100%;
    background: #2563eb;
    color: #fff;
}

.btn-login:hover {
    background: #1d4ed8;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-secondary {
    background: #e2e8f0;
    color: #0f172a;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
}

.login-footer {
    margin-top: 20px;
    padding: 14px;
    background: #f8fafc;
    border-radius: 12px;
    color: #475569;
    font-size: 13px;
    text-align: center;
}

.alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
    font-weight: bold;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: #0f172a;
    color: white;
    padding: 22px;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-bottom: 22px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    margin-bottom: 22px;
}

.brand h2 {
    margin: 0;
    font-size: 24px;
}

.brand span {
    font-size: 12px;
    color: #cbd5e1;
}

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

.menu-link {
    color: #cbd5e1;
    padding: 13px 14px;
    border-radius: 12px;
    display: block;
    transition: 0.2s;
    font-size: 15px;
}

.menu-link:hover {
    background: rgba(37,99,235,0.25);
    color: white;
}

.menu-link.sair {
    margin-top: 20px;
    background: rgba(220,38,38,0.18);
    color: #fecaca;
}

.main {
    margin-left: 280px;
    width: calc(100% - 280px);
    min-height: 100vh;
}

.topbar {
    background: white;
    padding: 22px 30px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar h1 {
    margin: 0;
    font-size: 26px;
    color: #0f172a;
}

.topbar p {
    margin: 4px 0 0;
    color: #64748b;
}

.user-box {
    text-align: right;
    background: #f8fafc;
    padding: 10px 16px;
    border-radius: 14px;
}

.user-box strong {
    display: block;
    color: #0f172a;
}

.user-box span {
    font-size: 12px;
    color: #2563eb;
    text-transform: uppercase;
    font-weight: bold;
}

.content {
    padding: 30px;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.card {
    background: white;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 30px rgba(15,23,42,0.06);
    border: 1px solid #e2e8f0;
}

.card-title {
    color: #2563eb;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 14px;
}

.card-value {
    font-size: 34px;
    font-weight: bold;
    margin-top: 12px;
    color: #0f172a;
}

.card-info {
    margin-top: 8px;
    color: #64748b;
    font-size: 14px;
}

.card.destaque {
    border-left: 6px solid #2563eb;
}

.card.alerta {
    border-left: 6px solid #f59e0b;
}

.panel {
    background: white;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(15,23,42,0.06);
    border: 1px solid #e2e8f0;
    margin-bottom: 24px;
}

.panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h2 {
    margin: 0;
    font-size: 21px;
    color: #1d4ed8;
}

.panel-body {
    padding: 24px;
}

.steps {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.step {
    padding: 10px 14px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #475569;
    font-weight: bold;
    font-size: 13px;
}

.step.done {
    background: #dcfce7;
    color: #166534;
}

.step.active {
    background: #dbeafe;
    color: #1d4ed8;
}

.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    background: #f8fafc;
    color: #2563eb;
    padding: 12px;
    font-size: 13px;
    text-transform: uppercase;
    border-bottom: 1px solid #e2e8f0;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.badge {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: bold;
}

.badge-green {
    background: #dcfce7;
    color: #166534;
}

.badge-red {
    background: #fee2e2;
    color: #991b1b;
}

@media (max-width: 900px) {
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
    }

    .app {
        display: block;
    }

    .main {
        margin-left: 0;
        width: 100%;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        display: block;
    }

    .user-box {
        text-align: left;
        margin-top: 14px;
    }
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.checkbox-line {
    height: 46px;
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #fff;
    font-weight: normal !important;
    color: #334155;
}

.checkbox-line input {
    width: auto !important;
    height: auto !important;
}

.form-actions {
    margin-top: 22px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-form input {
    flex: 1;
    height: 46px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 0 14px;
    font-size: 15px;
    outline: none;
}

.search-form input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

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

.btn-mini {
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    display: inline-block;
}

.btn-mini.editar {
    background: #dbeafe;
    color: #1d4ed8;
}

.btn-mini.status {
    background: #fef3c7;
    color: #92400e;
}

.btn-mini.excluir {
    background: #fee2e2;
    color: #991b1b;
}

small {
    color: #64748b;
}

@media (max-width: 900px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .search-form {
        flex-direction: column;
    }
}

.link-table {
    color: #2563eb;
    font-weight: bold;
}

.link-table:hover {
    text-decoration: underline;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    align-items: end;
}

.filter-button {
    display: flex;
    flex-direction: column;
}

.bi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    margin-bottom: 24px;
}

.empty-state {
    padding: 24px;
    border-radius: 14px;
    background: #f8fafc;
    color: #64748b;
    text-align: center;
    font-weight: bold;
}

.bar-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.bar-row {
    display: grid;
    grid-template-columns: 95px 1fr 130px;
    gap: 12px;
    align-items: center;
}

.bar-label {
    font-size: 13px;
    font-weight: bold;
    color: #334155;
}

.bar-value {
    font-size: 13px;
    font-weight: bold;
    color: #0f172a;
    text-align: right;
}

.bar-track {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #2563eb, #22c55e);
}

.product-row {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 12px;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.product-info strong {
    display: block;
    color: #0f172a;
    font-size: 14px;
}

.product-info small {
    display: block;
    margin-top: 4px;
    color: #64748b;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.info-box {
    padding: 18px;
    background: #f8fafc;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
}

.info-box strong {
    display: block;
    color: #1d4ed8;
    margin-bottom: 8px;
}

.info-box span {
    color: #475569;
    font-size: 14px;
}

@media (max-width: 1100px) {
    .filter-grid {
        grid-template-columns: 1fr 1fr;
    }

    .bi-grid {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .filter-grid {
        grid-template-columns: 1fr;
    }

    .bar-row {
        grid-template-columns: 1fr;
    }

    .bar-value {
        text-align: left;
    }

    .product-row {
        grid-template-columns: 1fr;
    }
}

.painel-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.painel-card {
    background: white;
    border-radius: 22px;
    padding: 24px;
    box-shadow: 0 8px 30px rgba(15,23,42,0.06);
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    min-height: 280px;
}

.painel-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: linear-gradient(135deg, #2563eb, #22c55e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 18px;
}

.painel-content {
    flex: 1;
}

.painel-categoria {
    display: inline-block;
    background: #dbeafe;
    color: #1d4ed8;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.painel-card h3 {
    margin: 0 0 10px;
    color: #0f172a;
    font-size: 21px;
}

.painel-card p {
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.painel-empresa {
    margin-top: 14px;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 12px;
    color: #475569;
    font-size: 13px;
    font-weight: bold;
}

.painel-footer {
    margin-top: 22px;
}

.painel-footer .btn-primary,
.painel-footer .btn-secondary {
    width: 100%;
    text-align: center;
}

button[disabled] {
    opacity: 0.65;
    cursor: not-allowed;
}

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

@media (max-width: 700px) {
    .painel-grid {
        grid-template-columns: 1fr;
    }
}

.reposicao-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.reposicao-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 22px;
    padding: 22px;
    box-shadow: 0 8px 30px rgba(15,23,42,0.06);
}

.reposicao-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.reposicao-card h3 {
    margin: 10px 0 6px;
    color: #0f172a;
    font-size: 20px;
}

.reposicao-card p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.reposicao-numeros {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.reposicao-numeros div {
    background: #f8fafc;
    border-radius: 16px;
    padding: 14px;
    text-align: center;
}

.reposicao-numeros strong {
    display: block;
    font-size: 24px;
    color: #1d4ed8;
}

.reposicao-numeros span {
    display: block;
    font-size: 12px;
    color: #64748b;
    font-weight: bold;
    text-transform: uppercase;
    margin-top: 4px;
}

.reposicao-progress {
    height: 14px;
    margin-bottom: 14px;
}

.reposicao-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #64748b;
    font-size: 13px;
    margin-bottom: 16px;
}

.reposicao-form {
    display: grid;
    gap: 10px;
}

.reposicao-form textarea {
    width: 100%;
    min-height: 70px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 12px;
    resize: vertical;
    outline: none;
    font-family: Arial, Helvetica, sans-serif;
}

.reposicao-form textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.search-form select {
    height: 46px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 0 14px;
    font-size: 15px;
    outline: none;
    background: #fff;
}

@media (max-width: 1000px) {
    .reposicao-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 650px) {
    .reposicao-numeros {
        grid-template-columns: 1fr;
    }
}

.badge-blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.dashboard-bar-row {
    grid-template-columns: 70px 1fr 210px;
}

.dashboard-bar-row .bar-value small {
    display: block;
    color: #64748b;
    font-size: 11px;
    font-weight: normal;
    margin-top: 3px;
}

@media (max-width: 700px) {
    .dashboard-bar-row {
        grid-template-columns: 1fr;
    }
}

/* CORREÇÃO FINAL - BOTÃO SAIR FIXO NO MENU LATERAL */

.sidebar {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    overflow-y: auto !important;
    padding-bottom: 95px !important;
}

.main {
    margin-left: 280px !important;
}

.menu-footer {
    position: fixed !important;
    left: 22px !important;
    bottom: 22px !important;
    width: 236px !important;
    z-index: 9999 !important;
    padding: 0 !important;
    margin: 0 !important;
}

.menu-footer .menu-link.sair,
.menu-link.sair {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    background: #3b1020 !important;
    color: #fecdd3 !important;
    border-radius: 14px !important;
    font-weight: bold !important;
    padding: 14px 18px !important;
    text-decoration: none !important;
}

.menu-footer .menu-link.sair:hover,
.menu-link.sair:hover {
    background: #7f1d1d !important;
    color: #ffffff !important;
}

@media (max-width: 900px) {
    .sidebar {
        position: relative !important;
        height: auto !important;
        padding-bottom: 20px !important;
    }

    .main {
        margin-left: 0 !important;
    }

    .menu-footer {
        position: relative !important;
        left: auto !important;
        bottom: auto !important;
        width: auto !important;
        margin-top: 20px !important;
    }
}

.linha-alerta-reposicao {
    background: #fff1f2 !important;
}

.linha-alerta-reposicao td {
    border-bottom: 1px solid #fecdd3 !important;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.inline-form input[type="text"] {
    width: 100px;
    min-width: 100px;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #334155;
}

.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.card-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.12);
}

.reposicao-card {
    border-left: 5px solid #f59e0b;
}

.panel-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-form input[type="number"] {
    width: 105px;
    min-width: 105px;
}

.inline-form input[name="fornecedor"] {
    width: 160px;
    min-width: 160px;
}

.compra-card {
    border-left: 5px solid #16a34a;
}

.badge-gray {
    background: #e5e7eb;
    color: #374151;
}

.badge-yellow {
    background: #fef3c7;
    color: #92400e;
}

/* Correção: menu lateral com rolagem própria */
.sidebar {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-bottom: 120px !important;
}

/* Mantém o conteúdo afastado do menu */
.main {
    margin-left: 280px !important;
}

/* Botão sair não deve esconder os menus */
.menu-footer {
    position: relative !important;
    left: auto !important;
    bottom: auto !important;
    width: auto !important;
    margin-top: 25px !important;
    padding-bottom: 20px !important;
}

/* Melhora a rolagem no Chrome */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.25);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

/* FORÇA SCROLL NO MENU LATERAL */
html,
body {
    min-height: 100%;
}

.sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 280px !important;
    height: 100vh !important;
    max-height: 100vh !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    z-index: 1000 !important;
    padding-bottom: 180px !important;
}

.sidebar .menu {
    display: block !important;
    padding-bottom: 140px !important;
}

.sidebar .menu-link {
    flex-shrink: 0 !important;
}

.menu-footer {
    position: static !important;
    width: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    margin-top: 25px !important;
    padding-bottom: 40px !important;
}

.main {
    margin-left: 280px !important;
    width: calc(100% - 280px) !important;
}

/* Barra de rolagem do menu */
.sidebar::-webkit-scrollbar {
    width: 8px !important;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05) !important;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.35) !important;
    border-radius: 20px !important;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.55) !important;
}

/* AJUSTE DEFINITIVO DO MENU LATERAL */
.sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 280px !important;
    height: 100vh !important;
    min-height: 100vh !important;
    max-height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-bottom: 60px !important;
}

.sidebar .brand {
    flex-shrink: 0 !important;
}

.sidebar .menu {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding-bottom: 80px !important;
}

.sidebar .menu-link {
    flex-shrink: 0 !important;
}

.menu-footer {
    position: relative !important;
    left: auto !important;
    bottom: auto !important;
    width: auto !important;
    margin-top: 20px !important;
    padding-bottom: 40px !important;
}

.main {
    margin-left: 280px !important;
}

/* Scroll visual do menu */
.sidebar::-webkit-scrollbar {
    width: 8px !important;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05) !important;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.35) !important;
    border-radius: 20px !important;
}

/* MENU LATERAL COM ROLAGEM INTERNA DEFINITIVA */
.sidebar {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 280px !important;
    height: 100vh !important;
    max-height: 100vh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

.sidebar .brand {
    flex: 0 0 auto !important;
}

.sidebar .menu {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-bottom: 30px !important;
    display: flex !important;
    flex-direction: column !important;
}

.sidebar .menu-link {
    flex: 0 0 auto !important;
}

.menu-footer {
    flex: 0 0 auto !important;
    position: relative !important;
    left: auto !important;
    bottom: auto !important;
    width: auto !important;
    margin-top: 10px !important;
    padding-bottom: 18px !important;
}

.main {
    margin-left: 280px !important;
    width: calc(100% - 280px) !important;
}

/* Scroll visível no menu */
.sidebar .menu::-webkit-scrollbar {
    width: 8px !important;
}

.sidebar .menu::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05) !important;
}

.sidebar .menu::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.35) !important;
    border-radius: 20px !important;
}

/* CORREÇÃO FINAL DO MENU LATERAL */
.sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 280px !important;
    height: 100vh !important;
    max-height: 100vh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

.sidebar .brand {
    flex: 0 0 auto !important;
}

.sidebar .menu {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: calc(100vh - 170px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    padding-bottom: 20px !important;
}

.sidebar .menu-link {
    flex: 0 0 auto !important;
}

.menu-footer {
    flex: 0 0 auto !important;
    position: relative !important;
    left: auto !important;
    bottom: auto !important;
    width: auto !important;
    margin-top: 8px !important;
    padding-bottom: 12px !important;
}

.main {
    margin-left: 280px !important;
    width: calc(100% - 280px) !important;
}

/* Barra de rolagem dentro do menu */
.sidebar .menu::-webkit-scrollbar {
    width: 8px !important;
}

.sidebar .menu::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.08) !important;
}

.sidebar .menu::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.45) !important;
    border-radius: 20px !important;
}

/* CORREÇÃO REAL: liberar rolagem no sidebar inteiro */
.sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 280px !important;
    height: 100vh !important;
    max-height: 100vh !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    display: block !important;
    padding-bottom: 40px !important;
}

.sidebar .brand {
    display: flex !important;
    flex: none !important;
}

.sidebar .menu {
    display: block !important;
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
    padding-bottom: 40px !important;
}

.sidebar .menu-link {
    display: flex !important;
    flex: none !important;
    margin-bottom: 8px !important;
}

.menu-footer {
    position: static !important;
    left: auto !important;
    bottom: auto !important;
    width: auto !important;
    margin-top: 15px !important;
    padding-bottom: 30px !important;
}

.main {
    margin-left: 280px !important;
    width: calc(100% - 280px) !important;
}

/* Scroll visível no menu lateral */
.sidebar::-webkit-scrollbar {
    width: 8px !important;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.08) !important;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.45) !important;
    border-radius: 20px !important;
}

.perda-card {
    border-left: 5px solid #dc2626;
}

.consumo-card {
    border-left: 5px solid #f59e0b;
}

/* Correção dos filtros com datas personalizadas */
.search-form {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    align-items: center !important;
    width: 100% !important;
}

.search-form select {
    min-width: 150px !important;
    max-width: 240px !important;
}

.search-form input[type="date"] {
    width: 160px !important;
    min-width: 150px !important;
    max-width: 170px !important;
}

.search-form input[type="text"] {
    flex: 1 1 260px !important;
    min-width: 240px !important;
    max-width: 420px !important;
}

.search-form .btn-primary,
.search-form .btn-secondary,
.search-form button,
.search-form a {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
}

/* Evita barra horizontal na tela principal */
.main,
.content,
.panel,
.panel-body {
    overflow-x: hidden !important;
}

/* Em telas menores, cada campo ocupa melhor o espaço */
@media (max-width: 1100px) {
    .search-form select,
    .search-form input[type="date"],
    .search-form input[type="text"] {
        width: 100% !important;
        max-width: 100% !important;
        flex: 1 1 100% !important;
    }
}

/* =========================================================
   RESPONSIVO MOBILE ESSBI
   ========================================================= */

.mobile-menu-toggle {
    display: none;
}

.mobile-sidebar-overlay {
    display: none;
}

@media (max-width: 900px) {

    body {
        overflow-x: hidden !important;
    }

    .mobile-menu-toggle {
        display: flex !important;
        position: fixed !important;
        top: 14px !important;
        left: 14px !important;
        z-index: 10001 !important;
        width: 46px !important;
        height: 46px !important;
        border: 0 !important;
        border-radius: 14px !important;
        background: #2563eb !important;
        color: #ffffff !important;
        font-size: 24px !important;
        font-weight: 800 !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: 0 10px 25px rgba(0,0,0,0.25) !important;
        cursor: pointer !important;
    }

    .mobile-sidebar-overlay {
        display: none !important;
        position: fixed !important;
        inset: 0 !important;
        background: rgba(15, 23, 42, 0.55) !important;
        z-index: 9998 !important;
    }

    body.sidebar-mobile-open .mobile-sidebar-overlay {
        display: block !important;
    }

    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -295px !important;
        width: 280px !important;
        height: 100vh !important;
        max-height: 100vh !important;
        z-index: 9999 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        transition: left 0.25s ease-in-out !important;
        box-shadow: 15px 0 35px rgba(0,0,0,0.35) !important;
        padding-top: 70px !important;
    }

    body.sidebar-mobile-open .sidebar {
        left: 0 !important;
    }

    .main {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .topbar,
    .header,
    .page-header {
        padding-left: 72px !important;
        padding-right: 14px !important;
        min-height: 76px !important;
    }

    .topbar h1,
    .header h1,
    .page-header h1,
    h1 {
        font-size: 24px !important;
        line-height: 1.15 !important;
        word-break: normal !important;
    }

    .content,
    .container,
    .page-content,
    .main-content {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
        overflow-x: hidden !important;
    }

    .cards-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 14px !important;
        width: 100% !important;
    }

    .card {
        width: 100% !important;
        min-width: 0 !important;
        padding: 18px !important;
    }

    .card-title {
        font-size: 14px !important;
    }

    .card-value {
        font-size: 30px !important;
        line-height: 1.15 !important;
        word-break: break-word !important;
    }

    .card-info {
        font-size: 13px !important;
    }

    .panel {
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
        border-radius: 16px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .panel-header,
    .panel-header-flex {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }

    .panel-actions {
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
    }

    .panel-actions a,
    .panel-actions button {
        width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
    }

    .search-form {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        width: 100% !important;
    }

    .search-form select,
    .search-form input,
    .search-form input[type="text"],
    .search-form input[type="date"],
    .search-form button,
    .search-form a {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: 46px !important;
        box-sizing: border-box !important;
    }

    .table-responsive {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .table {
        min-width: 850px !important;
        width: 100% !important;
    }

    table {
        min-width: 850px !important;
    }

    th,
    td {
        white-space: nowrap !important;
        font-size: 12px !important;
    }

    td:first-child,
    th:first-child {
        padding-left: 10px !important;
    }

    .btn-primary,
    .btn-secondary,
    .btn-mini {
        min-height: 42px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .info-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .info-box {
        width: 100% !important;
    }

    .sidebar .brand {
        margin-top: 0 !important;
    }

    .sidebar .menu-link {
        font-size: 18px !important;
        padding: 14px 18px !important;
    }
}

/* Ajuste para celular pequeno */
@media (max-width: 480px) {
    .card-value {
        font-size: 26px !important;
    }

    .topbar h1,
    .header h1,
    .page-header h1,
    h1 {
        font-size: 22px !important;
    }

    .panel-header h2 {
        font-size: 20px !important;
    }
}

/* Correção clique menu mobile */
@media (max-width: 900px) {
    body.sidebar-mobile-open .sidebar {
        left: 0 !important;
        transform: translateX(0) !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    body.sidebar-mobile-open .mobile-sidebar-overlay {
        display: block !important;
    }

    .mobile-menu-toggle {
        pointer-events: auto !important;
        touch-action: manipulation !important;
    }

    .sidebar {
        pointer-events: auto !important;
    }
}

.recebimento-card {
    border-left: 5px solid #16a34a;
}

/* =========================================================
   LEITOR DE CÓDIGO DE BARRAS - MOBILE / DESKTOP
   ========================================================= */

.barcode-scan-btn {
    height: 46px !important;
    padding: 0 16px !important;
    border: 0 !important;
    border-radius: 14px !important;
    background: #16a34a !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    box-shadow: 0 8px 18px rgba(22, 163, 74, 0.25) !important;
}

.barcode-scan-btn:hover {
    background: #15803d !important;
}

.barcode-scanner-modal {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(15, 23, 42, 0.75) !important;
    z-index: 99999 !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    padding: 18px !important;
}

.barcode-scanner-box {
    width: 100% !important;
    max-width: 520px !important;
    background: #ffffff !important;
    border-radius: 20px !important;
    overflow: hidden !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35) !important;
}

.barcode-scanner-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 16px 18px !important;
    background: #2563eb !important;
    color: #ffffff !important;
    font-size: 18px !important;
}

.barcode-close-btn {
    border: 0 !important;
    background: rgba(255,255,255,0.18) !important;
    color: #ffffff !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 12px !important;
    font-size: 28px !important;
    line-height: 1 !important;
    cursor: pointer !important;
}

.barcode-reader {
    width: 100% !important;
    min-height: 320px !important;
    background: #000000 !important;
}

.barcode-scanner-info {
    padding: 14px 18px !important;
    color: #475569 !important;
    font-size: 14px !important;
    text-align: center !important;
}

@media (max-width: 900px) {
    .barcode-scan-btn {
        width: 100% !important;
    }

    .barcode-scanner-box {
        max-width: 100% !important;
        border-radius: 18px !important;
    }

    .barcode-reader {
        min-height: 280px !important;
    }
}

/* BOTÃO DIRETO DO LEITOR DE CÓDIGO */
.barcode-btn-direto {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 46px !important;
    min-width: 145px !important;
    margin-left: 8px !important;
    margin-top: 0 !important;
    background: #16a34a !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 14px !important;
    font-weight: 800 !important;
    font-size: 14px !important;
    cursor: pointer !important;
}

@media (max-width: 900px) {
    .barcode-btn-direto {
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 8px !important;
    }
}

/* BOTÃO FORÇADO DE CÂMERA */
.essbi-btn-camera-forcado {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 46px !important;
    min-width: 145px !important;
    margin-left: 8px !important;
    padding: 0 16px !important;
    background: #16a34a !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 14px !important;
    font-weight: 800 !important;
    font-size: 14px !important;
    cursor: pointer !important;
    white-space: nowrap !important;
}

@media (max-width: 900px) {
    .essbi-btn-camera-forcado {
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 8px !important;
    }
}
