/* ==========================================================================
   CIGAR STOCK - Folha de Estilos Global (css/style.css)
   ========================================================================== */

/* Cores e Variáveis Globais */
:root {
    --bg-dark: #0f1115;
    --card-bg: #1a1d24;
    --border-color: #2d3139;
    --border-input: #3a3f4d;
    --text-primary: #e2e8f0;
    --text-muted: #8a94a6;
    --text-inactive: #5c6475;
    --gold: #d4af37;
    --gold-hover: #bfa030;
    --danger: #e74c3c;
    --success: #2ecc71;
}

/* Reset e Configurações de Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-card-login {
    margin: 10% auto 0 auto;
            background-color: #1a1d24;
            border: 1px solid #2d3139;
            border-radius: 8px;
            width: 100%;
            max-width: 400px;
            padding: 40px 30px;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
        }

.login-header {
            text-align: center;
            margin-bottom: 30px;
        }

        .login-header h1 {
            font-size: 24px;
            color: #d4af37; /* Dourado Premium */
            letter-spacing: 1.5px;
            text-transform: uppercase;
            margin-bottom: 5px;
        }

        .login-header p {
            font-size: 13px;
            color: #8a94a6;
        }

/* Rodapé do Login */
        .login-footer {
            text-align: center;
            margin-top: 25px;
            font-size: 12px;
            color: #5c6475;
        }


/* Barra de Navegação */
.app-nav {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo h2 {
    font-size: 20px;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-menu {
    display: flex;
    gap: 20px;
    list-style: none;
}

.nav-item a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-item a:hover, .nav-item.active a {
    color: var(--gold);
}

.user-info {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-logout {
    color: var(--danger);
    text-decoration: none;
    border: 1px solid var(--danger);
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-logout:hover {
    background-color: var(--danger);
    color: #ffffff;
}

/* Content Container */
.app-container {
    flex: 1;
    padding: 30px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 25px;
}

.page-header h1 {
    font-size: 22px;
    color: #ffffff;
}

/* Alertas */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 25px;
}

.alert-success {
    background-color: rgba(46, 204, 113, 0.15);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-danger {
    background-color: rgba(231, 76, 60, 0.15);
    border: 1px solid var(--danger);
    color: var(--danger);
}

/* Grid Layouts */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    margin-bottom: 40px;
}

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

/* Cartões (Cards) */
.app-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 24px;
    height: fit-content;
}

.card-header {
    font-size: 16px;
    font-weight: 600;
    color: var(--gold);
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

/* Formulários, Inputs e Selects */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #a0aec0;
    margin-bottom: 8px;
}

.input-padrao {
    width: 100%;
    padding: 10px 14px;
    background-color: #121418;
    border: 1px solid var(--border-input);
    border-radius: 4px;
    color: #ffffff;
    font-size: 14px;
    transition: border-color 0.2s;
}

.input-padrao:focus {
    outline: none;
    border-color: var(--gold);
}

select.input-padrao {
    cursor: pointer;
}

/* Botões */
.btn-padrao {
    width: 100%;
    padding: 10px;
    background-color: var(--gold);
    border: none;
    border-radius: 4px;
    color: #121418;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-padrao:hover {
    background-color: var(--gold-hover);
}

/* Ações nas Tabelas */
.btn-acao-tabela {
    background: none;
    border: 1px solid var(--border-input);
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-desativar:hover {
    background-color: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.btn-reativar:hover {
    background-color: var(--success);
    border-color: var(--success);
    color: #fff;
}

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

.app-table th {
    color: var(--text-muted);
    font-weight: 500;
    padding: 12px 10px;
    border-bottom: 2px solid var(--border-color);
    text-align: left;
}

.app-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-color);
}

/* Utilitários */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.text-inactive {
    color: var(--text-inactive);
    font-style: italic;
}

.badge {
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
}

.badge-danger {
    background-color: rgba(224, 86, 86, 0.15);
    color: #f8a5a5;
    border: 1px solid var(--danger);
}

.badge-warning {
    background-color: rgba(212, 175, 55, 0.15);
    color: #f1c40f;
    border: 1px solid var(--gold);
}

.badge-success {
    background-color: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
    border: 1px solid var(--success);
}



        /* Barra de Navegação */
        .app-nav {
            background-color: #1a1d24;
            border-bottom: 1px solid #2d3139;
            padding: 15px 30px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .nav-logo h2 {
            font-size: 20px;
            color: #d4af37;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .nav-menu {
            display: flex;
            gap: 20px;
            list-style: none;
        }

        .nav-item a {
            color: #a0aec0;
            text-decoration: none;
            font-size: 14px;
            font-weight: 500;
            transition: color 0.2s;
        }

        .nav-item a:hover, .nav-item.active a {
            color: #d4af37;
        }

        .user-info {
            font-size: 13px;
            color: #8a94a6;
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .btn-logout {
            color: #e05656;
            text-decoration: none;
            border: 1px solid #e05656;
            padding: 5px 10px;
            border-radius: 4px;
            transition: all 0.2s;
        }

        .btn-logout:hover {
            background-color: #e05656;
            color: #ffffff;
        }

        /* Content Container */
        .app-container {
            flex: 1;
            padding: 30px;
            max-width: 1400px;
            width: 100%;
            margin: 0 auto;
        }

        .welcome-section {
            margin-bottom: 30px;
        }

        .welcome-section h1 {
            font-size: 24px;
            font-weight: 400;
        }

        .welcome-section span {
            color: #d4af37;
            font-weight: 600;
        }

        /* KPIs Grid */
        .kpi-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 20px;
            margin-bottom: 40px;
        }

        .app-card {
            background-color: #1a1d24;
            border: 1px solid #2d3139;
            border-radius: 6px;
            padding: 24px;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }

        .kpi-title {
            font-size: 12px;
            text-transform: uppercase;
            color: #8a94a6;
            letter-spacing: 0.8px;
            margin-bottom: 10px;
        }

        .kpi-value {
            font-size: 28px;
            font-weight: 700;
            color: #ffffff;
        }

        .kpi-value.highlight {
            color: #d4af37;
        }

        /* Secções de Tabelas e Informações */
        .dashboard-sections {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
            gap: 30px;
        }

        .section-box {
            background-color: #1a1d24;
            border: 1px solid #2d3139;
            border-radius: 6px;
            padding: 24px;
        }

        .section-header {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 20px;
            color: #d4af37;
            border-bottom: 1px solid #2d3139;
            padding-bottom: 10px;
        }

        /* Tabelas */
        .app-table {
            width: 100%;
            border-collapse: collapse;
            text-align: left;
            font-size: 14px;
        }

        .app-table th {
            color: #8a94a6;
            font-weight: 500;
            padding: 12px 8px;
            border-bottom: 2px solid #2d3139;
        }

        .app-table td {
            padding: 12px 8px;
            border-bottom: 1px solid #2d3139;
            color: #e2e8f0;
        }

        .badge {
            padding: 4px 8px;
            font-size: 11px;
            font-weight: 600;
            border-radius: 4px;
            text-transform: uppercase;
        }

        .badge-danger {
            background-color: rgba(224, 86, 86, 0.15);
            color: #f8a5a5;
            border: 1px solid #e05656;
        }

        .badge-warning {
            background-color: rgba(212, 175, 55, 0.15);
            color: #f1c40f;
            border: 1px solid #d4af37;
        }

        .text-muted {
            color: #5c6475;
            font-style: italic;
        }

        @media (max-width: 768px) {
            .app-nav {
                flex-direction: column;
                gap: 15px;
            }
            .dashboard-sections {
                grid-template-columns: 1fr;
            }
        }



/* ==========================================================================
   Estilos Específicos para a Gestão de Marcas
   ========================================================================== */

/* Grid Principal de Marcas (Formulário + Listagem) */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    margin-bottom: 40px;
}

/* Títulos das Páginas Internas */
.page-header {
    margin-bottom: 25px;
}

.page-header h1 {
    font-size: 22px;
    color: #ffffff;
}

/* Caixas de Alerta e Feedback */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 25px;
}

.alert-success {
    background-color: rgba(46, 204, 113, 0.15);
    border: 1px solid #2ecc71;
    color: #2ecc71;
}

.alert-danger {
    background-color: rgba(231, 76, 60, 0.15);
    border: 1px solid #e74c3c;
    color: #e74c3c;
}

/* Cabeçalhos de Cartões e Formulários */
.card-header {
    font-size: 16px;
    font-weight: 600;
    color: #d4af37;
    margin-bottom: 20px;
    border-bottom: 1px solid #2d3139;
    padding-bottom: 10px;
}

/* Componentes de Formulário (Inputs de texto padrão) */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #a0aec0;
    margin-bottom: 8px;
}

.input-padrao {
    width: 100%;
    padding: 10px 14px;
    background-color: #121418;
    border: 1px solid #3a3f4d;
    border-radius: 4px;
    color: #ffffff;
    font-size: 14px;
    transition: border-color 0.2s;
}

.input-padrao:focus {
    outline: none;
    border-color: #d4af37;
}

/* Botões do Formulário e Ações de Tabela */
.btn-padrao {
    width: 100%;
    padding: 10px;
    background-color: #d4af37;
    border: none;
    border-radius: 4px;
    color: #121418;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-padrao:hover {
    background-color: #bfa030;
}

.btn-acao-tabela {
    background: none;
    border: 1px solid #3a3f4d;
    padding: 4px 8px;
    border-radius: 4px;
    color: #e2e8f0;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-desativar:hover {
    background-color: #e74c3c;
    border-color: #e74c3c;
    color: #fff;
}

.btn-reativar:hover {
    background-color: #2ecc71;
    border-color: #2ecc71;
    color: #fff;
}

.text-center {
    text-align: center;
}

/* Responsividade Adaptativa */
@media (max-width: 768px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================================
   Estilos Específicos para a Gestão de Charutos (Produtos)
   ========================================================================== */

.badge-success {
    background-color: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
    border: 1px solid #2ecc71;
}

.text-inactive {
    color: #5c6475;
    text-decoration: line-through;
    font-style: italic;
}

/* ==========================================================================
   Estilos Específicos para a Gestão de Entradas
   ========================================================================== */
.text-right {
    text-align: right;
}

.badge-success {
    background-color: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
    border: 1px solid #2ecc71;
}


/* ==========================================================================
   Estilos Específicos para o Módulo de Saídas / Vendas
   ========================================================================== */
.carrinho-tabela {
    width: 100%;
    margin-bottom: 20px;
    border-collapse: collapse;
}

.carrinho-tabela th {
    font-size: 12px;
    color: #8a94a6;
    border-bottom: 1px solid #2d3139;
    padding: 8px 5px;
    text-align: left;
}

.carrinho-tabela td {
    padding: 8px 5px;
    border-bottom: 1px dotted #2d3139;
}

.btn-adicionar {
    background-color: transparent;
    color: #d4af37;
    border: 1px dashed #d4af37;
    width: 100%;
    padding: 8px;
    font-weight: 600;
    text-align: center;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 15px;
    transition: all 0.2s;
    text-transform: uppercase;
    font-size: 12px;
}

.btn-adicionar:hover {
    background-color: rgba(212, 175, 55, 0.1);
}

.btn-remover-item {
    color: #e05656;
    border: 1px solid #e05656;
    background: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.btn-remover-item:hover {
    background-color: #e05656;
    color: #fff;
}

.fatura-detalhes {
    font-size: 11px;
    color: #8a94a6;
    margin-top: 5px;
    line-height: 1.4;
}

/* ==========================================================================
   Estilos para o Modal de Visualização de Fatura (Saídas)
   ========================================================================== */
.modal-fatura {
    display: none; /* Escondido por padrão */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #1a1d24;
    border: 1px solid #2d3139;
    border-radius: 8px;
    width: 100%;
    max-width: 600px;
    padding: 30px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #8a94a6;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #e05656;
}

.fatura-titulo-modal {
    font-size: 18px;
    color: #d4af37;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
    border-bottom: 1px solid #2d3139;
    padding-bottom: 10px;
}

.fatura-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
    font-size: 13px;
    color: #a0aec0;
}

.fatura-meta-item strong {
    color: #ffffff;
}


/* ==========================================================================
   Novo Modal de Fatura - Padrão de Impressão Comercial
   ========================================================================== */

/* Janela Escura do Modal (Sobreposição no Sistema) */
.modal-fatura {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px;
}

/* Área de Controle (Botões flutuantes acima da folha) */
.modal-acoes-topo {
    max-width: 800px;
    width: 100%;
    margin: 0 auto 10px auto;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* A Folha de Papel Branca (Estilo Comercial) */
.invoice-box {
    background-color: #ffffff !important;
    color: #000000 !important;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 40px;
    border-radius: 4px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;
    line-height: 24px;
    box-sizing: border-box;
}

/* Topo da Fatura (Logo e Número) */
.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #000000;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.invoice-logo {
    font-size: 26px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #121418;
}

/* Espaço reservado para imagem do logo futuramente */
.invoice-logo img {
    max-height: 60px;
}

.invoice-number {
    text-align: right;
    font-size: 16px;
    color: #121418;
}

.invoice-number h2 {
    font-size: 24px;
    color: #000000;
    margin-bottom: 5px;
}

/* Grid de Metadados (Cliente e Operador) */
.invoice-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
    font-size: 14px;
}

.invoice-meta-block h4 {
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
    margin-bottom: 8px;
    text-transform: uppercase;
    font-size: 12px;
    color: #555;
}

/* Tabela de Itens da Fatura */
.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
    font-size: 14px;
}

.invoice-table th {
    background-color: #f4f4f4 !important;
    color: #000000 !important;
    font-weight: 700;
    padding: 10px;
    border: 1px solid #ddd;
    text-align: left;
}

.invoice-table td {
    padding: 10px;
    border: 1px solid #ddd;
    color: #111111;
}

.invoice-total-row {
    font-size: 18px;
    font-weight: 700;
    text-align: right;
    border-top: 2px solid #000000;
    padding-top: 15px;
}

/* Botões de Ação do Modal */
.btn-print {
    background-color: #2ecc71;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 12px;
}

.btn-close-modal {
    background-color: #e05656;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 12px;
}

/* ==========================================================================
   REGRAS ABSOLUTAS DE IMPRESSÃO (MÁGICA DO PRINT)
   ========================================================================== */
@media print {
    /* Esconde absolutamente tudo o que pertence ao sistema */
    body *, .app-nav, .app-container, .modal-acoes-topo, .modal-close {
        display: none !important;
    }
    
    /* Configura o modal e a folha para ocuparem o topo do papel */
    .modal-fatura {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: auto !important;
        background: #ffffff !important;
        display: block !important;
        padding: 0 !important;
    }

    .invoice-box {
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}


/* ==========================================================================
   Estilos para Filtros e Paginação de Saídas
   ========================================================================== */
.table-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    background-color: #121418;
    padding: 10px 15px;
    border-radius: 4px;
    border: 1px solid #2d3139;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #8a94a6;
}

.select-limite {
    background-color: #1a1d24;
    border: 1px solid #3a3f4d;
    color: #ffffff;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.pagination-container {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 15px;
}

.page-link {
    background-color: #1a1d24;
    border: 1px solid #2d3139;
    color: #a0aec0;
    padding: 6px 12px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.2s;
}

.page-link:hover, .page-link.active {
    background-color: #d4af37;
    color: #121418;
    border-color: #d4af37;
    font-weight: 600;
}

/* Container para alinhar o botão de adicionar ao centro */
.carrinho-acoes-centro {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    width: 100%;
}

/* Container para empurrar o botão de conclusão para o canto direito inferior */
.carrinho-acoes-finalizar {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid #2d3139;
    padding-top: 20px;
    margin-top: 10px;
    width: 100%;
}


/* ==========================================================================
   HEADER COMPACTO & RESPONSIVO (DESKTOP + MOBILE)
   ========================================================================== */
.app-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #1a1d24;
    padding: 0 25px;
    height: 70px;
    border-bottom: 1px solid #2d3139;
    position: relative;
    z-index: 999;
}

.nav-brand-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo h2 {
    color: #d4af37;
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 5px;
}

.nav-item a {
    color: #a0aec0;
    text-decoration: none;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.nav-item a:hover {
    color: #ffffff;
    background-color: #242933;
}

/* Zona Direita */
.nav-right-zone {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Seletor de Moedas Premium */
.currency-selector {
    display: flex;
    background-color: #121418;
    padding: 3px;
    border-radius: 6px;
    border: 1px solid #2d3139;
}

.currency-btn {
    color: #8a94a6;
    text-decoration: none;
    font-size: 11px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.2s;
}

.currency-btn:hover {
    color: #ffffff;
}

.currency-btn.active {
    background-color: #d4af37;
    color: #121418 !important;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 13px;
    color: #a0aec0;
}

.user-level {
    color: #8a94a6;
}

.btn-logout {
    background-color: rgba(231, 76, 60, 0.1);
    border: 1px solid #e74c3c;
    color: #e74c3c;
    padding: 6px 14px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.2s;
}

.btn-logout:hover {
    background-color: #e74c3c;
    color: #ffffff;
}

/* Botão de Menu Hambúrguer Oculto no Desktop */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.mobile-menu-toggle .bar {
    width: 100%;
    height: 2px;
    background-color: #ffffff;
    transition: all 0.2s ease;
}

/* ==========================================================================
   REGRAS MEDIA QUERY - MOBILE & TABLET (ECRÃS MENORES QUE 992px)
   ========================================================================== */
@media (max-width: 992px) {
    .app-nav {
        flex-direction: column;
        height: auto;
        padding: 15px 20px;
        gap: 15px;
        align-items: stretch;
    }

    .nav-brand-container {
        width: 100%;
    }

    .mobile-menu-toggle {
        display: flex; /* Revela o botão no telemóvel */
    }

    /* Transforma o menu vertical e esconde por padrão */
    .nav-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        background-color: #121418;
        border-radius: 6px;
        padding: 10px 0;
        border: 1px solid #2d3139;
    }

    /* Classe ativada via JavaScript ao clicar no botão */
    .nav-menu.mobile-open {
        display: flex;
    }

    .nav-item a {
        display: block;
        padding: 12px 20px;
        border-radius: 0;
        border-left: 3px solid transparent;
    }

    .nav-item a:hover {
        border-left-color: #d4af37;
        background-color: #1a1d24;
    }

    .nav-right-zone {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 15px;
        width: 100%;
    }

    .currency-selector {
        justify-content: space-between;
    }

    .currency-btn {
        flex: 1;
        text-align: center;
        padding: 8px 0;
    }

    .user-info {
        justify-content: space-between;
        background-color: #242933;
        padding: 10px 15px;
        border-radius: 6px;
    }
}


.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-bottom: 30px; }
.chart-container { background: #1a1d24; border-radius: 8px; padding: 20px; border: 1px solid #2d3139; }
.kpi-card { background: #1a1d24; padding: 20px; border-radius: 8px; border-left: 4px solid #d4af37; box-shadow: 0 4px 6px rgba(0,0,0,0.3); }





/* Estilos Mobile para Dashboard */
@media (max-width: 600px) {
    /* Ajuste nos KPIs para ocuparem toda a largura */
    .kpi-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Transformar a tabela de Stock Crítico numa lista (Card view) */
    .app-table thead {
        display: none; /* Esconde o cabeçalho no mobile */
    }

    .app-table, .app-table tbody, .app-table tr, .app-table td {
        display: block;
        width: 100%;
    }

    .app-table tr {
        margin-bottom: 15px;
        border-bottom: 2px solid #3a3f4d;
        padding-bottom: 10px;
    }

    /* Cada célula passa a ter um rótulo (data-label) */
    .app-table td {
        text-align: right;
        padding-left: 50%;
        position: relative;
    }

    .app-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        font-weight: bold;
        color: #d4af37;
        text-transform: uppercase;
        font-size: 11px;
    }
}

@media (max-width: 600px) {
    /* Ajuste para as linhas da tabela */
    .app-table tr {
        display: flex;
        flex-direction: column;
        background: #121418; /* Leve contraste no fundo de cada item */
        padding: 15px;
        border-radius: 8px;
        margin-bottom: 10px;
    }

    /* Alinhamento dos itens */
    .app-table td {
        display: flex;
        justify-content: space-between; /* Rótulo à esquerda, Valor à direita */
        padding: 8px 0;
        border-bottom: 1px solid #2d3139;
    }

    /* Remover o ::before antigo e usar o display flex acima */
    .app-table td::before {
        position: static;
        padding-right: 10px;
    }
}

@media (max-width: 768px) {
    /* 1. Forçar o grid a virar coluna e ignorar a configuração original */
    .form-grid {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
    }


    /* 3. Ajustar padding para ganhar espaço */
    .app-table td {
        padding: 5px !important;
        font-size: 11px !important;
    }
}

@media (max-width: 768px) {
    /* Esconde a tabela no mobile */
    .app-table thead { display: none; }
    .app-table, .app-table tbody, .app-table tr, .app-table td { 
        display: block; 
        width: 100%; 
    }

    /* Transforma cada linha da tabela num card */
    .app-table tr {
        background: #1a1d24;
        border: 1px solid #2d3139;
        border-radius: 8px;
        padding: 15px;
        margin-bottom: 15px;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    /* Ajusta os botões para ficarem lado a lado e ocuparem a largura */
    .app-table td:last-child {
        display: flex;
        justify-content: space-between;
        gap: 5px;
        padding-top: 10px;
        border-top: 1px solid #333;
    }
    
    .btn-acao-tabela { flex: 1; padding: 10px !important; }
}

@media (max-width: 768px) {
    /* Remove o estilo de 'caixa' dos itens no modal */
    .modal-content .item-box, 
    .modal-content div[style*="border"] {
        background: transparent !important;
        border: none !important;
        margin-bottom: 5px !important;
        padding: 5px !important;
    }

    /* Força os textos a ficarem legíveis */
    .modal-content span, .modal-content div {
        color: #ffffff !important;
        font-size: 14px !important;
    }

    .modalsaida{ background:#fff!important; }

    .invoice-box{
        box-shadow: initial;
    }
}

.modalsaida .btn-desativar{
        margin-top: 50px;
        padding: 20px;
    }

.mobile-cell-value {
    display: contents;
}

/* ==========================================================================
   MOBILE FINAL — regras consolidadas para todo o sistema
   ========================================================================== */
@media (max-width: 768px) {
    html {
        -webkit-text-size-adjust: 100%;
    }

    body {
        min-width: 0;
        overflow-x: hidden;
    }

    .app-nav {
        position: sticky;
        top: 0;
        z-index: 1000;
        padding: 12px 16px;
        gap: 10px;
    }

    .nav-brand-container {
        min-height: 36px;
    }

    .nav-logo h2 {
        font-size: 17px;
        line-height: 1.2;
    }

    .mobile-menu-toggle {
        width: 44px;
        height: 44px;
        padding: 12px 10px;
        border: 1px solid var(--border-color);
        border-radius: 6px;
    }

    .mobile-menu-toggle.is-active .bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .mobile-menu-toggle.is-active .bar:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.is-active .bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .nav-menu {
        max-height: calc(100vh - 190px);
        overflow-y: auto;
        margin: 0;
    }

    .nav-item a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .nav-right-zone {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
    }

    .currency-selector {
        min-width: 0;
    }

    .currency-btn {
        min-height: 38px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .user-info {
        min-height: 38px;
        padding: 0;
        background: transparent;
    }

    .user-name {
        display: none;
    }

    .btn-logout {
        min-height: 38px;
        display: flex;
        align-items: center;
        padding: 8px 14px;
    }

    .app-container {
        padding: 18px 14px 28px;
        max-width: 100%;
        min-width: 0;
    }

    .page-header {
        margin-bottom: 16px;
    }

    .page-header h1 {
        font-size: 20px;
        line-height: 1.25;
    }

    .app-card,
    .section-box,
    .chart-container,
    .kpi-card {
        min-width: 0;
        padding: 16px !important;
        margin-bottom: 18px !important;
        border-radius: 7px;
    }

    .card-header {
        font-size: 15px;
        line-height: 1.3;
        margin-bottom: 16px;
    }

    .main-grid,
    .dashboard-grid,
    .dashboard-sections,
    .kpi-grid,
    .form-grid,
    .report-grid {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    .form-grid {
        display: grid !important;
        margin-bottom: 14px !important;
    }

    form,
    form > div {
        min-width: 0;
    }

    form > div[style*="display: flex"],
    form > div[style*="display:flex"] {
        flex-direction: column;
        align-items: stretch !important;
        gap: 14px !important;
    }

    .form-group {
        width: 100%;
        min-width: 0 !important;
        margin-bottom: 14px;
    }

    .input-padrao,
    select.input-padrao,
    textarea.input-padrao {
        width: 100%;
        max-width: 100%;
        min-height: 44px !important;
        font-size: 16px;
    }

    .btn-padrao,
    .btn-adicionar,
    .btn-desativar,
    .btn-reativar {
        width: 100% !important;
        min-height: 44px;
        padding: 11px 14px !important;
        margin-left: 0 !important;
    }

    .table-filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .filter-group {
        width: 100%;
        justify-content: space-between;
    }

    .select-limite {
        min-height: 40px;
    }

    /* Tabelas transformadas em cartões legíveis, com rótulos automáticos. */
    .app-table {
        display: block !important;
        width: 100% !important;
        max-width: 100%;
        min-width: 0;
        overflow: visible;
        white-space: normal;
    }

    .app-table thead {
        display: none !important;
    }

    .app-table tbody {
        display: grid !important;
        width: 100%;
        gap: 12px;
    }

    .app-table tr {
        display: grid !important;
        width: 100% !important;
        min-width: 0;
        background: #151820 !important;
        border: 1px solid #303540 !important;
        border-radius: 8px;
        padding: 6px 14px !important;
        margin: 0 !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
    }

    .app-table td {
        display: grid !important;
        grid-template-columns: minmax(92px, 38%) minmax(0, 1fr);
        align-items: center;
        gap: 12px;
        width: 100% !important;
        min-width: 0 !important;
        padding: 10px 0 !important;
        text-align: right !important;
        font-size: 13px !important;
        line-height: 1.35;
        white-space: normal !important;
        overflow-wrap: anywhere;
        border-bottom: 1px solid var(--border-color) !important;
    }

    .app-table td:last-child {
        border-bottom: 0 !important;
    }

    .app-table td::before {
        content: attr(data-label) !important;
        display: block;
        position: static !important;
        min-width: 0;
        padding: 0 !important;
        color: #8f9aae;
        font-size: 10px;
        font-weight: 700;
        line-height: 1.25;
        text-align: left;
        text-transform: uppercase;
        letter-spacing: .45px;
    }

    .app-table td small {
        white-space: normal;
    }

    .app-table .mobile-cell-value {
        display: block;
        min-width: 0;
    }

    .app-table td:empty {
        display: none !important;
    }

    .app-table td.mobile-empty-state {
        display: block !important;
        padding: 18px 4px !important;
        text-align: center !important;
        border: 0 !important;
    }

    .app-table td.mobile-empty-state::before {
        content: none !important;
    }

    .app-table td:last-child:not(.mobile-empty-state) {
        grid-template-columns: 92px minmax(0, 1fr);
        align-items: start;
        gap: 8px;
    }

    .app-table td:last-child > .mobile-cell-value {
        grid-column: 2;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .btn-acao-tabela {
        display: inline-flex !important;
        width: 100% !important;
        min-width: 0;
        min-height: 38px;
        align-items: center;
        justify-content: center;
        padding: 8px 10px !important;
        margin: 2px 0 !important;
        white-space: nowrap;
    }

    .app-table td:last-child form {
        display: inline-block !important;
        width: 100%;
    }

    .app-table td:last-child form .btn-acao-tabela {
        width: 100% !important;
    }

    .carrinho-tabela {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .carrinho-tabela thead {
        display: table-header-group;
    }

    .carrinho-tabela tbody {
        display: table-row-group;
    }

    .carrinho-tabela tr {
        display: table-row;
    }

    .carrinho-tabela th,
    .carrinho-tabela td {
        display: table-cell;
        min-width: 110px;
        padding: 10px 8px;
    }

    .carrinho-tabela th:first-child,
    .carrinho-tabela td:first-child {
        min-width: 260px;
    }

    .carrinho-acoes-centro,
    .carrinho-acoes-finalizar {
        width: 100%;
        margin-top: 14px;
    }

    .pagination-container {
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 4px;
    }

    .modal-cigar,
    .modal-cliente,
    #modalEditarUsuario,
    .modalsaida,
    .modal-fatura {
        padding: 10px !important;
        align-items: flex-start !important;
        overflow-y: auto;
    }

    .modal-content-cigar,
    .modal-cliente-conteudo,
    #modalEditarUsuario > .app-card,
    .modalsaida .invoice-box,
    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 10px auto !important;
        padding: 18px !important;
        max-height: none;
    }

    .invoice-meta-grid {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    .invoice-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

@media (max-width: 380px) {
    .app-container {
        padding-inline: 10px;
    }

    .app-card {
        padding: 13px !important;
    }

    .nav-logo h2 {
        font-size: 15px;
    }
}
