/* ========================================
   SISTEMA DE CONTROLE DE ESTOQUE
   Estilos Profissionais v2.0
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* ── Paleta primária: Azul-ardósia profundo ── */
    --primary-color: #1a3050;
    --primary-dark: #0c1a2b;
    --primary-light: #284d7a;

    /* ── Acento: Bronze quente (mais elegante que ouro amarelo) ── */
    --accent-color: #b8922a;
    --accent-gold: #b8922a;
    --accent-hover: #d4a83a;
    --accent-bright: #e8c060;   /* versão clara para hover em fundos escuros */

    /* ── Sidebar: Quase-preto com tom azulado ── */
    --sidebar-bg: #080e18;
    --color-bg-sidebar: #080e18;
    --sidebar-border: #141e2d;
    --sidebar-item-hover: #111a27;
    --sidebar-item-active: #162235;
    --sidebar-text: #7a8fa8;
    --sidebar-text-hover: #c8d8e8;
    --sidebar-text-active: #d4a83a;

    /* ── Conteúdo: Fundo levemente azulado (não cinzento genérico) ── */
    --content-bg: #f0f4f8;
    --bg-light: #f0f4f8;
    --bg-white: #ffffff;
    --bg-card: #ffffff;
    --border-color: #dde4ed;
    --border-strong: #c4cfd9;

    /* ── Representantes: cores mantidas mas levemente mais saturadas ── */
    --rep-kolte: #5ba8e8;
    --rep-isa: #4ec87a;
    --rep-ades: #f0923a;
    --rep-fl: #a882e0;
    --rep-imbel: #e85858;

    /* ── Semáforo ── */
    --success-color: #1aad5a;
    --success-bg: rgba(26,173,90,0.07);
    --danger-color: #e03535;
    --danger-bg: rgba(224,53,53,0.07);
    --warning-color: #e8a020;
    --warning-bg: rgba(232,160,32,0.07);
    --info-color: #0d90d4;
    --info-bg: rgba(13,144,212,0.07);

    /* ── Tipografia ── */
        --font-primary: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: 'Inter', 'IBM Plex Sans', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, 'Courier New', monospace;
    --text-primary: #111a27;
    --text-secondary: #5a6d82;
    --text-muted: #8fa0b4;
    --text-light: #f0f6fc;

    /* ── Sombras mais definidas ── */
    --shadow-xs: 0 1px 2px rgba(8,14,24,0.06);
    --shadow-sm: 0 2px 4px rgba(8,14,24,0.07), 0 1px 2px rgba(8,14,24,0.05);
    --shadow-md: 0 4px 10px rgba(8,14,24,0.09), 0 2px 4px rgba(8,14,24,0.06);
    --shadow-lg: 0 10px 24px rgba(8,14,24,0.10), 0 4px 8px rgba(8,14,24,0.07);
    --shadow-xl: 0 20px 40px rgba(8,14,24,0.13), 0 8px 16px rgba(8,14,24,0.08);
    --shadow-inset: inset 0 1px 3px rgba(8,14,24,0.08);

    /* ── Transição padrão ── */
    --transition: all 0.18s cubic-bezier(.4,0,.2,1);
    --transition-slow: all 0.3s cubic-bezier(.4,0,.2,1);

    /* ── Bordas arredondadas ── */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* ── Layout ── */
    --sidebar-width: 224px;
    --sidebar-collapsed-width: 58px;
    --header-height: 62px;
}

/* ========================================
   Sidebar (fixed left)
   ======================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--color-bg-sidebar, #080e18);
    border-right: 1px solid var(--sidebar-border, #141e2d);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
    /* Textura sutil de ruído para profundidade */
    background-image:
        linear-gradient(180deg, rgba(255,255,255,0.015) 0%, transparent 60%),
        linear-gradient(var(--color-bg-sidebar, #080e18), var(--color-bg-sidebar, #080e18));
}
.sidebar .sidebar-top {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar .logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(145deg, #0d1e30 0%, #162840 60%, #0a1520 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(184, 146, 42, 0.4);
    box-shadow: 0 4px 14px rgba(0,0,0,0.5), inset 0 1px 0 rgba(212,168,58,0.15);
    overflow: hidden;
    flex: 0 0 38px;
}

.sidebar .logo-svg {
    width: 100%;
    height: 100%;
    transform: scale(1.1);
}
.sidebar .logo-text h1 {
    color: #dce8f4;
    font-size: 0.95rem;
    margin: 0;
    font-weight: 700;
    line-height: 1;
    font-family: var(--font-display);
    letter-spacing: 0.3px;
}
.sidebar .logo-text .subtitle {
    font-size: 9.5px;
    text-transform: uppercase;
    color: var(--sidebar-text, #7a8fa8);
    font-weight: 600;
    letter-spacing: 0.8px;
    margin-top: 3px;
}
.sidebar-nav {
    margin-top: 12px;
    overflow: auto;
    flex: 1 1 auto;
    padding-right: 6px;
}
.nav-group { margin-bottom: 14px; }
.nav-group-label {
    font-size: 9.5px;
    color: #3d5068;
    margin-bottom: 5px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
    padding-left: 8px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 12.5px;
    color: var(--sidebar-text, #7a8fa8);
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.1px;
}
.nav-item .nav-text { flex: 1; }
.nav-item.active {
    background: var(--sidebar-item-active, #162235);
    color: var(--sidebar-text-active, #d4a83a);
    border-left: 2px solid var(--accent-color, #b8922a);
    padding-left: 8px;
    box-shadow: inset 1px 0 0 rgba(184,146,42,0.15);
}
.nav-item:hover:not(.active) {
    background: var(--sidebar-item-hover, #111a27);
    color: var(--sidebar-text-hover, #c8d8e8);
}
.nav-item .nav-icon { opacity: 0.7; flex-shrink: 0; }
.nav-item.active .nav-icon { opacity: 1; }
.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.faturamento-label { font-size: 12px; color: #94d3a2; font-weight: 600; }
.faturamento-value { font-size: 1rem; font-weight: 700; color: var(--success-color); }
.cloud-status { display: flex; align-items: center; gap: 8px; color: #8b949e; font-size: 0.9rem; }
.fs-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.fs-online { background: #28a745; box-shadow: 0 0 6px rgba(40,167,69,0.5); }
.fs-offline { background: #6b7280; box-shadow: none; }

/* Ensure main content leaves space for the sidebar */
.container {
    margin-left: 0;
    max-width: 100%;
    padding: 0;
    box-sizing: border-box;
}

/* Layout desktop: deslocamento global do conteúdo para não ficar sob a sidebar.
   Usar padding no body evita falhas quando algum bloco está fora de .container. */
@media (min-width: 1201px) {
    body {
        padding-left: var(--sidebar-width);
    }
}

@media (min-width: 901px) and (max-width: 1200px) {
    body {
        padding-left: var(--sidebar-collapsed-width);
    }

    body.sidebar-expanded {
        padding-left: var(--sidebar-width);
    }
}

@media (max-width: 900px) {
    body {
        padding-left: 0;
    }
}

/* ========================================
    Accessibility & Global helpers
    ======================================== */

/* Visible focus for keyboard users */
*:focus {
     outline: 2px solid rgba(26,48,80,0.18);
     outline-offset: 2px;
     box-shadow: 0 0 0 3px rgba(184,146,42,0.12);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-light) !important;
    box-shadow: 0 0 0 3px rgba(40,77,122,0.12) !important;
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
     * { transition: none !important; animation: none !important; }
}

/* Numeric / monetary inputs and displays should align right and use tabular numbers */
.input-valor,
input[id$="_valor"],
input[id*="valor"],
.readonly-field,
.cell-valor,
.item-venda-row .item-valor,
.col-valor-un, .col-valor-total {
     text-align: right;
     font-variant-numeric: tabular-nums;
}

/* Small header spacing refinement to improve density */
header .header-content { padding: 10px 20px; }
.logo-text h1 { font-size: 1.1rem; }

/* Badge / indicator refinement */
#loggedAccountBadge { background: var(--accent-color); color: #fff; box-shadow: var(--shadow-xs); }
.badge-rep.imbel { background: rgba(30,58,95,0.12); color: var(--primary-color); }

/* Badge para vendas/contratos cancelados */
.badge-cancelado {
    background: #b71c1c;
    color: #fff;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}
.row-contrato-resumo.contrato-cancelado { opacity: 0.8; background: rgba(183,28,28,0.03); }
.row-contrato-detalhe .badge-cancelado { font-size: 12px; padding: 2px 6px; border-radius: 4px; }

/* ========================================
    Tables: zebra, hover, sticky header
    ======================================== */

table tbody tr:nth-child(odd) { background: rgba(13,25,40,0.02); }
table tbody tr:hover { background: rgba(30,58,95,0.04); }

/* Make header cells sticky when possible to improve readability on long tables */
table thead th { position: sticky; top: 0; background: linear-gradient(180deg,#fff,#f7fbff); z-index: 2; }

/* Wrapper com rolagem apenas para tabelas largas/longas (usado em Inventário) */
.table-wrapper.table-scroll {
    width: 100%;
    max-width: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    /* Ajuste a altura disponível conforme o layout (header + filtros + margens) */
    max-height: calc(100vh - 260px);
    position: relative;
}

/* Congelar primeira coluna (Produto) dentro da tabela de inventário */
#tabelaEstoque th.col-produto {
    position: sticky;
    left: 0;
    z-index: 6; /* acima dos sub-headers */
    background: linear-gradient(180deg,#fff,#f7fbff);
    border-right: 1px solid var(--border-color);
}
#tabelaEstoque td.col-produto,
#tabelaEstoque td.produto-nome {
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 2;
    border-right: 1px solid var(--border-color);
}
/* Congelar coluna "Ações" (direita) em tabelas de dashboard */
/* Aplicamos regras tanto para a classe `.col-acoes` quanto para o fallback `:last-child`.
   Usamos z-index altos para garantir que fique acima das células do corpo, e `top:0` nos
   cabeçalhos para que o comportamento top+right funcione corretamente. */
.dashboard-table th.col-acoes,
.dashboard-table th:last-child {
    position: sticky;
    top: 0;
    right: 0;
    z-index: 995; /* acima do thead (950) */
    background: var(--primary-color) !important;
    color: #fff;
    border-left: 1px solid var(--border-color);
}
.dashboard-table td.col-acoes,
.dashboard-table td:last-child {
    position: sticky;
    right: 0;
    z-index: 890; /* abaixo do cabeçalho, acima das linhas */
    background: var(--bg-white);
    border-left: 1px solid var(--border-color);
    min-width: 80px;
    text-align: center;
}
/* Topbar única da área de estoque */
#acoesEstoque.actions-bar {
    background: #ffffff;
    border-bottom: 1px solid #d0d7de;
    padding: 0 20px;
    height: 52px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 1400 !important;
}

/* Aumentar z-index dos sub-headers do thead para evitar sobreposição por células fixas */
#tabelaEstoque thead tr:nth-child(2) th { z-index: 5; }

/* ========================================
    Buttons: disabled state and small polish
    ======================================== */

.btn[disabled], .btn:disabled {
     opacity: 0.6;
     pointer-events: none;
     box-shadow: none;
     transform: none;
     filter: grayscale(.08);
}

/* Slightly reduce hover intensity for better subtlety */
.btn:hover { box-shadow: 0 8px 20px rgba(14,30,60,0.08); }

/* ========================================
    Modal improvements
    ======================================== */
.modal-content { max-height: 84vh; overflow: auto; }
@media (max-width: 900px) { .modal-content { width: 92%; padding: 18px; } }

/* Use CSS grid for large modal forms where applicable (fallback to existing layout) */
.modal .form-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ========================================
    Print tweaks
    ======================================== */
@media print {
     header, .actions-bar, .tabs-navigation, .hamburger-btn, .auth-panel { display: none !important; }
     body { background: #fff; color: #000; }
    table thead th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ========================================
    Small utilities
    ======================================== */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }


body {
    font-family: var(--font-primary);
    background: var(--bg-light);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.5;
}

/* .container consolidated above */

/* ========================================
   HEADER / NAVBAR
   ======================================== */

header {
    background: rgba(255,255,255,0.95);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    box-shadow: 0 1px 0 var(--border-color), 0 4px 16px rgba(8,14,24,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 30px; /* padronizado com content-area */
    max-width: 1800px;
    margin: 0 auto;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(145deg, #0d1e30 0%, #162840 60%, #0a1520 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 6px 20px rgba(8, 14, 24, 0.4),
        0 2px 6px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(212, 168, 58, 0.18),
        inset 0 -1px 3px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(184, 146, 42, 0.35);
    position: relative;
    overflow: hidden;
    transition: var(--transition-slow);
}

.logo-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 215, 0, 0.1) 50%,
        transparent 70%
    );
    transform: rotate(45deg);
    animation: shine 8s infinite;
}

@keyframes shine {
    0%, 100% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    50% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.logo-icon:hover {
    transform: translateY(-1px);
    box-shadow:
        0 10px 28px rgba(8, 14, 24, 0.5),
        0 4px 10px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(212, 168, 58, 0.25),
        inset 0 -1px 3px rgba(0, 0, 0, 0.4);
    border-color: rgba(184, 146, 42, 0.55);
}

.logo-svg {
    width: 100%;
    height: 100%;
    transform-origin: 50% 50%;
    transform: scale(1.15);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: transform .18s ease;
}


.logo-text {
    display: inline-block;
    vertical-align: middle;
}
.logo-text h1 {
    display: block;
    font-size: 1.55rem;
    color: var(--primary-dark);
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.1;
    margin: 0;
    font-family: var(--font-display);
}

.logo-text {
    --logo-title-width: auto;
}

/* Sortable table header styles */
th[data-sort] {
    cursor: pointer;
    user-select: none;
}
th[data-sort]::after {
    content: '⇅';
    display: inline-block;
    font-size: 0.76rem;
    margin-left: 6px;
    color: #94a3b8;
    opacity: 0.75;
}
th[data-sort].sort-asc::after { content: '▲'; color: var(--primary-color); opacity: 0.95; }
th[data-sort].sort-desc::after { content: '▼'; color: var(--primary-color); opacity: 0.95; }
th[data-sort]:hover { background: rgba(30,58,95,0.03); }

.logo-text .subtitle {
    display: block;
    box-sizing: border-box;
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2.5px;
    margin-top: 4px;
    font-weight: 600;
    line-height: 1.1;
    width: var(--logo-title-width, auto);
    white-space: normal;
    word-wrap: break-word;
}

@media (max-width: 768px) {
    .logo-text h1 { font-size: 1.15rem; }
    .logo-text .subtitle { font-size: 0.82rem; letter-spacing: 1.2px; }
}

.header-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: nowrap;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

/* Ajustes para painel de autenticação e informações da conta
   - posicionar à direita abaixo do indicador de sincronização
   - melhorar contraste de fonte e disposição visual */
.header-content { position: relative; }
.auth-panel, .logged-account-info {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(15,23,42,0.06);
    padding: 6px 10px;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-top: 0; /* manter alinhamento vertical central */
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.auth-panel .btn, .auth-panel button, .auth-panel .btn-outline {
    color: var(--text-primary) !important;
    border-color: rgba(15,23,42,0.06) !important;
    background: transparent !important;
}

#authUserDisplay, #loggedAccountEmail, #fsText {
    color: var(--text-primary) !important;
    font-weight: 600;
}

#loggedAccountBadge {
    margin-left: 8px;
    display: inline-block;
    padding: 4px 8px;
    background: #1e90ff; /* destaque azul mais visível */
    color: #ffffff;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

/* Em telas muito grandes, garantir que o bloco fique fixo à direita */
@media (min-width: 1200px) {
    .auth-panel, .logged-account-info { position: relative; }
}

.header-stat {
    text-align: center;
    padding: 7px 14px;
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
    transition: var(--transition);
    min-width: 88px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
    position: relative;
}

.header-stat::before {
    content: '';
    position: absolute;
    bottom: 0; left: 20%; right: 20%;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--border-color);
    transition: var(--transition);
}

.header-stat:hover {
    background: var(--bg-white);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.header-stat.accent { background: var(--success-bg); border-color: rgba(26,173,90,0.18); }
.header-stat.accent::before { background: var(--success-color); }

.header-stat.highlight { background: rgba(184,146,42,0.05); border-color: rgba(184,146,42,0.18); }
.header-stat.highlight::before { background: var(--accent-color); }

.header-stat .stat-value {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.header-stat.accent .stat-value { color: var(--success-color); }
.header-stat.highlight .stat-value { color: var(--accent-color); }

.header-stat .stat-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 600;
}

/* Centralizar os cards no header em telas grandes */
@media (min-width: 992px) {
    .header-info {
        position: absolute;
        left: 50%;
        top: 50%;
        /* deslocar levemente para a esquerda para não sobrepor a data */
        transform: translate(-60%, -50%);
        justify-content: center;
        max-width: none;
        overflow: visible;
        z-index: 50;
    }
    .header-right {
        margin-left: auto;
        display: flex;
        align-items: center;
        gap: 12px;
        z-index: 60;
    }
}

/* Garantir que o título não quebre para linha inferior */
.logo-text h1 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Em telas pequenas, permitir wrap e tornar os cards menores */
@media (max-width: 992px) {
    .header-info { max-width: none; flex-wrap: wrap; overflow: visible; }
    .header-stat { min-width: 80px; padding: 8px 10px; }
    .logo-text h1 { font-size: 1.15rem; }
    .logo-text .subtitle { font-size: 0.65rem; }
}

.current-date {
    color: var(--text-secondary);
    font-size: 0.78rem;
    padding: 7px 14px;
    background: rgba(255,255,255,0.6);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(15,23,42,0.04);
    font-weight: 500;
}

/* Firestore status indicator */
.firestore-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(255,255,255,0.6);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.8rem;
    border: 1px solid rgba(15,23,42,0.04);
}
.firestore-status .fs-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 6px rgba(0,0,0,0.25);
}
.fs-online { background: #28a745; box-shadow: 0 0 6px rgba(40,167,69,0.5); }
.fs-offline { background: #dc3545; box-shadow: 0 0 6px rgba(220,53,69,0.4); }
.fs-warning { background: #ffc107; box-shadow: 0 0 6px rgba(255,193,7,0.4); }
.fs-text { color: var(--text-primary); font-weight:600; }

/* ========================================
   NAVEGAÇÃO POR ABAS
   ======================================== */

.tabs-navigation {
    background: var(--bg-white);
    padding: 0 24px;
    display: flex;
    gap: 2px;
    border-bottom: 2px solid var(--border-color);
    box-shadow: var(--shadow-xs);
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs-navigation::-webkit-scrollbar { display: none; }

.tab-btn {
    padding: 13px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    position: relative;
    letter-spacing: 0.01em;
}

.tab-btn:hover {
    color: var(--primary-color);
    background: rgba(26, 48, 80, 0.035);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--accent-color);
    font-weight: 700;
    background: rgba(26, 48, 80, 0.03);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    border-radius: 2px 2px 0 0;
    filter: blur(1px);
    opacity: 0.6;
}

.tab-btn span {
    font-size: 1rem;
}

/* tab-content transitions handled in new section below */

/* ========================================
   BARRA DE AÇÕES
   ======================================== */

.actions-bar {
    background: linear-gradient(180deg, #ffffff 0%, #fafcff 100%);
    padding: 14px 28px;
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 0 rgba(8,14,24,0.04);
    flex-wrap: wrap;
}

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

.actions-divider {
    width: 1px;
    height: 35px;
    background: var(--border-color);
    margin: 0 10px;
}

.btn {
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background 0.2s;
}

.btn:hover::after {
    background: rgba(255,255,255,0.1);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
}

.btn-success {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #15803d, #16a34a);
}

.btn-info {
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
    color: white;
}

.btn-info:hover {
    background: linear-gradient(135deg, #0369a1, #0284c7);
}

.btn-warning {
    background: linear-gradient(135deg, var(--accent-color), #ddb62e);
    color: var(--primary-dark);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #b8911f, var(--accent-color));
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c, #dc2626);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline::after { display: none; }

.btn-outline:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-icon {
    font-size: 1rem;
    line-height: 1;
}

/* ========================================
   ÁREA DE CONTEÚDO
   ======================================== */

.content-area {
    padding: 25px 30px;
    max-width: 1800px;
    margin: 0 auto;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Modal / Login Card styles */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Deve ficar acima da sidebar (sidebar z-index:2000) */
    z-index: 3100;
}
.modal[aria-hidden="true"] { display: none; }
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
}
.modal-content {
    position: relative;
    width: 420px;
    max-width: calc(100% - 40px);
    background: linear-gradient(180deg,#ffffff,#f7fbff);
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(14,30,60,0.2);
    padding: 26px 28px;
    /* Garantir que o conteúdo do modal esteja acima da sidebar */
    z-index: 3110;
    overflow: hidden;
}
.modal-close {
    position: absolute;
    right: 14px;
    top: 10px;
    border: none;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
    color: #6b7280;
}
.login-card { text-align: center; }
.login-card-icon {
    font-size: 34px;
    width: 72px;
    height: 72px;
    margin: 0 auto 12px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,#f0f7ff,#e6f0ff);
    border-radius: 12px;
    color: var(--primary-color);
}
.login-card-title {
    font-size: 20px;
    color: var(--primary-color);
    margin-top: 6px;
    margin-bottom: 6px;
}
.login-card-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 18px;
}
.form-group { text-align: left; margin-bottom: 12px; }
.form-group label { display:block; font-size:13px; color:var(--text-secondary); margin-bottom:6px; }
.form-group input[type="email"], .form-group input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: #fff;
    font-size: 14px;
    color: var(--text-primary);
    box-shadow: var(--shadow-xs);
}
.password-row { display:flex; gap:10px; align-items:center; }
.show-pass { font-size:13px; color:var(--text-secondary); display:flex; align-items:center; gap:6px; }
.form-actions { margin-top: 16px; }
.btn-block { width:100%; padding:12px 18px; border-radius:10px; font-weight:600; }

@media (max-width:480px) {
    .modal-content { width: 92%; padding: 18px; }
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--accent-color);
    border-radius: 2px;
}

.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-info {
    background: rgba(23, 162, 184, 0.1);
    color: var(--info-color);
}

/* ========================================
   DASHBOARD CARDS
   ======================================== */

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dash-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    border-left: 3px solid;
    position: relative;
    overflow: hidden;
}

.dash-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 80px; height: 80px;
    border-radius: 50%;
    opacity: 0.04;
    background: currentColor;
    transform: translate(25%, -25%);
}

.dash-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.dash-card.card-blue  { border-left-color: var(--info-color); }
.dash-card.card-green { border-left-color: var(--success-color); }
.dash-card.card-orange { border-left-color: var(--accent-color); }
.dash-card.card-purple { border-left-color: #8b5cf6; }

.dash-card-icon {
    font-size: 2.2rem;
    opacity: 0.85;
    flex-shrink: 0;
}

.dash-card-info {
    flex: 1;
    min-width: 0;
}

.dash-card-value {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-display);
}

.dash-card-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ================================
   Consulta de Precificações — estilos
   ================================ */
#tabelaConsultaPrec { width:100%; border-collapse:collapse; font-size:0.88rem; }
#tabelaConsultaPrec th, #tabelaConsultaPrec td { border-bottom:1px solid var(--border-color); padding:8px; vertical-align:middle; }
.prec-expirada { opacity:0.6; background: rgba(255,243,230,0.6); }
.badge-prec-ativa { display:inline-block; background:#16a34a; color:#fff; padding:4px 8px; border-radius:12px; font-size:0.75rem; }
.badge-prec-expirada { display:inline-block; background:#d97706; color:#fff; padding:4px 8px; border-radius:12px; font-size:0.75rem; }
.badge-rep { display:inline-block; padding:4px 6px; border-radius:6px; background:rgba(26,48,80,0.08); color:var(--primary-color); font-weight:600; font-size:0.82rem; }
.btn-action { margin-left:6px; padding:6px 8px; border-radius:6px; border:1px solid var(--border-color); background:#fff; cursor:pointer; font-size:0.85rem; }
.btn-action.btn-edit { background:#f1faff; border-color:#bfdbfe; }
.btn-action.btn-delete { background:#fff7f7; border-color:#fecaca; color:var(--danger-color); }
.filtros-container .filtro-group { display:flex; flex-direction:column; gap:6px; margin-right:12px; min-width:120px; }
#paginacaoConsultaPrec { display:flex; gap:12px; align-items:center; margin-top:12px; flex-wrap:wrap; }
.page-info { color:var(--text-secondary); font-size:0.9rem; }
.page-buttons { display:flex; gap:6px; align-items:center; }
.page-btn { border:1px solid var(--border-color); background:#fff; padding:6px 8px; border-radius:6px; cursor:pointer; font-weight:600; color:var(--text-primary); }
.page-btn.active { background:var(--primary-color); color:#fff; border-color:var(--primary-color); }
.page-btn[disabled] { opacity:0.5; cursor:default; pointer-events:none; }

.empty-state { padding:28px 12px; text-align:center; color:var(--text-secondary); }
.empty-state .empty-icon { font-size:32px; margin-bottom:8px }
.empty-state .empty-text { font-weight:600; color:var(--text-primary); margin-bottom:6px }
.empty-state .empty-hint { font-size:0.9rem }

/* Correções específicas para a Tabela de Consulta de Precificações */
#tabelaConsultaPrec thead th {
    /* Cabeçalho escuro e texto legível */
    background: linear-gradient(180deg, var(--primary-color), var(--primary-light));
    color: #fff;
}

/* Fixar coluna de ações à direita com fundo e sombra para não sobrepor conteúdos */
#tabelaConsultaPrec thead th:last-child {
    position: sticky;
    right: 0;
    z-index: 995; /* acima das células do corpo */
}

#tabelaConsultaPrec tbody td:last-child {
    position: sticky;
    right: 0;
    z-index: 890; /* abaixo do cabeçalho, acima das linhas */
    background: #fff; /* evita transparência sobre os dados */
    box-shadow: -6px 0 10px rgba(0,0,0,0.04);
}

/* Garantir que botões na coluna ações não tenham overflow e fiquem alinhados */
#tabelaConsultaPrec td:last-child .btn-action { display:inline-flex; align-items:center; gap:6px; }


/* ========================================
   DASHBOARD GRID
   ======================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    margin-bottom: 25px;
}

.dashboard-section {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.dashboard-section.full-width {
    grid-column: 1 / -1;
}

.dashboard-section .section-header {
    padding: 14px 20px;
    margin-bottom: 0;
    background: linear-gradient(180deg, #fafcff 0%, #f4f7fb 100%);
    border-bottom: 1px solid var(--border-color);
}

.dashboard-section .section-title {
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.dashboard-section .section-title::before {
    height: 14px;
    width: 3px;
}

/* ========================================
   TABELA DE ESTOQUE
   ======================================== */

.table-container {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: visible;
    border: 1px solid var(--border-color);
}

.table-container.compact {
    box-shadow: none;
    border-radius: 0;
}

.table-wrapper {
    overflow-x: auto;
    max-height: calc(100vh - 320px);
    overflow-y: auto;
    position: relative; /* necessário para que elementos sticky se calculem corretamente dentro do wrapper */
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8rem;
}

.dashboard-table {
    font-size: 0.85rem;
}

/* Garantir cabeçalho escuro e legível para tabelas de dashboard (Distribuição, Vendas, Controle de Envio) */
.dashboard-table thead th {
    background: var(--primary-color) !important;
    color: #ffffff !important;
}

thead {
    position: sticky;
    top: 0;
    z-index: 950; /* garantir que o cabeçalho fique acima das células do corpo, mas abaixo de modais */
    /* força camada de composição para evitar problemas de stacking em alguns navegadores */
   
}

th {
    background: var(--primary-color);
    color: white;
    padding: 12px 10px;
    text-align: center;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    border: none;
    white-space: nowrap;
}

.dashboard-table th {
    font-size: 0.75rem;
    padding: 14px 15px;
}

/* Observação: regras específicas para a coluna Ações foram definidas acima
   (fusão com fallback :last-child) para evitar duplicidade e conflitos.
*/

th.col-produto {
    min-width: 280px;
    text-align: left;
    padding-left: 20px;
    background: var(--primary-dark);
    position: sticky;
    left: 0;
    top: 0;
    z-index: 951; /* acima de todos os outros th por ser sticky em 2 direções */
}

.header-rep {
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.header-rep.kolte { background: #3d5a80; }
.header-rep.isa { background: #5c4d7d; }
.header-rep.lc { background: #2d6a4f; }
.header-rep.ades { background: #9c4a1a; }
.header-rep.fl { background: #7b2d26; }
.header-rep.imbel { background: #1e3a5f; }
.header-geral { background: var(--primary-dark); }

.sub-header {
    background: var(--primary-color); /* cor sólida para funcionar com sticky */
    font-size: 0.65rem;
    padding: 8px 6px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: white;
}

/* Herdar cores dos representantes nos sub-headers (cada grupo de 3) */
thead tr:nth-child(2) th:nth-child(3n+1):nth-child(-n+3) { background: #3d5a80; }  /* KOLTE */
thead tr:nth-child(2) th:nth-child(n+4):nth-child(-n+6) { background: #5c4d7d; }   /* ISA */
thead tr:nth-child(2) th:nth-child(n+7):nth-child(-n+9) { background: #2d6a4f; }   /* LC */
thead tr:nth-child(2) th:nth-child(n+10):nth-child(-n+12) { background: #9c4a1a; } /* ADES */
thead tr:nth-child(2) th:nth-child(n+13):nth-child(-n+15) { background: #7b2d26; } /* FL */
thead tr:nth-child(2) th:nth-child(n+16):nth-child(-n+18) { background: #1e3a5f; } /* IMBEL */
thead tr:nth-child(2) th:nth-child(n+19):nth-child(-n+21) { background: var(--primary-dark); } /* CONSOLIDADO */

/* Segunda linha do header (Disp/Venda/Saldo) precisa de top offset para sticky funcionar */
thead tr:first-child th {
    top: 0;
}

thead tr:nth-child(2) th {
    top: 35px; /* altura da primeira linha do header */
}

td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    font-variant-numeric: tabular-nums;
    transition: background 0.15s ease;

    /* Não criar novo contexto de empilhamento aqui — manter z-index padrão para evitar sobreposição do cabeçalho */
    position: static;
}

.dashboard-table td {
    padding: 12px 15px;
    font-size: 0.9rem;
}

tbody tr {
    background: var(--bg-white);
}

tbody tr:nth-child(even) {
    background: #f7fafd;
}

tbody tr:hover {
    background: #edf2f9;
}

tbody tr:hover td.produto-nome {
    background: #e4ecf5;
}

tbody tr:nth-child(even) td.produto-nome {
    background: #f7fafd;
}

/* Forçar th individuais a ficarem acima do corpo em navegadores com stacking contexts estranhos */
thead th {
    position: sticky;
    top: 0;
    z-index: 950;
   
}

/* Aumentar z-index da primeira coluna do cabeçalho para evitar sobreposição */
thead th.col-produto {
    z-index: 951;
}

.table-wrapper {
    position: relative;
}

.cell-disp { color: var(--text-primary); font-weight: 500; }
.cell-venda { color: var(--primary-light); font-weight: 600; }
.cell-saldo { color: var(--success-color); font-weight: 600; }
.cell-saldo.negativo { color: var(--danger-color); background: rgba(220, 53, 69, 0.08); }
.cell-saldo.negativo { font-weight: 800; }

/* Garantir que saldos consolidados negativos também fiquem vermelhos */
#tabelaEstoque td.geral-saldo.negativo {
    color: var(--danger-color);
    background: rgba(220, 53, 69, 0.06);
    font-weight: 800;
}

/* Totais negativos na linha de totais */
tr.total-row td.geral-saldo.negativo {
    color: var(--danger-color);
    background: rgba(220, 53, 69, 0.06);
}
.cell-saldo.baixo { color: #e67e22; background: rgba(230, 126, 34, 0.08); }
.cell-zero { color: #adb5bd; }

/* Animação sutil para chamar atenção a valores negativos */
@keyframes pulso-negativo {
    0% { box-shadow: 0 0 0 0 rgba(220,53,69,0.00); transform: translateY(0); }
    50% { box-shadow: 0 0 8px 2px rgba(220,53,69,0.08); transform: translateY(-1px); }
    100% { box-shadow: 0 0 0 0 rgba(220,53,69,0.00); transform: translateY(0); }
}

.cell-saldo.negativo.animate-negativo {
    animation: pulso-negativo 1.6s ease-in-out infinite;
}

/* Aplicar animação também a saldos gerais/total quando negativos */
#tabelaEstoque td.geral-saldo.negativo.animate-negativo,
tr.total-row td.geral-saldo.negativo.animate-negativo {
    animation: pulso-negativo 1.6s ease-in-out infinite;
}
.cell-valor {
    color: var(--success-color);
    font-weight: 600;
    text-align: right;
    padding-right: 20px;
}

.cell-qtd {
    font-weight: 600;
    color: var(--primary-color);
}

.geral-disp,
.geral-venda,
.geral-saldo {
    background: #f0f4f8 !important;
    font-weight: 600;
    border-left: 2px solid var(--primary-color);
}

.geral-disp { color: var(--text-primary); }
.geral-venda { color: var(--primary-color); }
.geral-saldo { color: var(--success-color); }

tr.total-row {
    background: linear-gradient(90deg, #e4ecf5 0%, #dce6f0 100%) !important;
    font-weight: 700;
}

tr.total-row td {
    border-top: 2px solid var(--primary-color);
    padding: 11px 8px;
    font-size: 0.84rem;
    color: var(--primary-dark);
}

tr.total-row td.produto-nome {
    background: linear-gradient(90deg, #cdd8e6 0%, #c4d1e2 100%);
    font-family: var(--font-display);
    font-size: 0.82rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--primary-dark);
}

tr.total-row:hover {
    background: linear-gradient(90deg, #dae4ef 0%, #d2deec 100%) !important;
}

/* ========================================
   MODAIS
   ======================================== */

.modal {
    display: none;
    position: fixed;
    /* Deve ficar acima da sidebar (sidebar z-index:2000) */
    z-index: 3100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    animation: fadeIn 0.2s cubic-bezier(.4,0,.2,1);
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-white);
    margin: 0;
    padding: 0;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 700px;
    box-shadow: var(--shadow-xl);
    animation: slideIn 0.3s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.06);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close {
    color: rgba(255,255,255,0.8);
    font-size: 24px;
    font-weight: 400;
    cursor: pointer;
    transition: var(--transition);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.close:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.modal-body {
    padding: 20px 20px 0 20px;
    overflow: auto;
    flex: 1 1 auto;
}

/* Tornar o modal com altura limitada e o corpo rolável para manter o rodapé visível */
.modal-content {
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

/* Permitir redimensionar a janela do modal pelo usuário */
.modal-content {
    resize: both;
    overflow: auto;
    min-width: 480px;
    min-height: 320px;
}

/* Modal grande com navegação vertical */
.modal-content.modal-lg {
    max-width: 900px;
}

.modal-inner {
    display: flex;
    gap: 20px;
}

.modal-nav {
    width: 200px;
    background: transparent;
    padding: 10px 0 10px 10px;
    border-right: 1px solid var(--border-color);
    height: 56vh;
    overflow: auto;
}

.modal-nav ul {
    list-style: none;
}

.modal-nav li {
    margin: 6px 0;
}

.modal-nav a {
    display: block;
    padding: 8px 12px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 6px;
}

.modal-nav a:hover,
.modal-nav a:focus {
    background: var(--bg-light);
}

.modal-form {
    flex: 1 1 auto;
    max-height: 56vh;
    overflow: auto;
    padding-right: 8px;
}

.form-section { padding-bottom: 16px; }

/* Container de itens dentro do modal - rolagem interna quando muitos itens */
.itens-venda-container {
    max-height: 38vh;
    overflow-y: auto;
    padding-right: 8px;
}

/* Permitir também rolagem horizontal quando em layout horizontal */
.itens-venda-container { overflow: auto; }

/* Layout vertical (padrão) */
.itens-venda-container.itens-layout-vertical {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Layout horizontal: itens organizados em cards lado-a-lado com rolagem horizontal */
.itens-venda-container.itens-layout-horizontal {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: flex-start;
    white-space: nowrap;
}

.itens-venda-container.itens-layout-horizontal .item-venda-row {
    display: flex;
    flex-direction: column;
    width: 320px;
    min-width: 280px;
    background: #fbfdff;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.itens-venda-container.itens-layout-horizontal .item-venda-row .item-subtotal {
    text-align: right;
}

/* Estilo das linhas de item para melhorar leitura */
.item-venda-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.item-venda-row .item-produto {
    min-width: 260px;
    flex: 1 1 320px;
}

.item-venda-row .item-quantidade {
    width: 90px;
    flex: 0 0 90px;
}

.item-venda-row .item-valor {
    width: 140px;
    flex: 0 0 140px;
}

.item-venda-row .item-subtotal {
    min-width: 120px;
    flex: 0 0 120px;
    text-align: right;
}

/* Em telas pequenas, empilhar elementos para caber melhor */
@media (max-width: 600px) {
    .item-venda-row { flex-direction: column; align-items: stretch; }
    .item-venda-row .item-quantidade,
    .item-venda-row .item-valor,
    .item-venda-row .item-subtotal { width: 100%; flex: none; text-align: left; }
}

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

.form-group:last-child {
    margin-bottom: 0;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Fix: garantir que elementos de navegação (abas/header/actions) apareçam
   acima da sidebar em desktop — evita que fiquem ocultos atrás da barra */
@media (min-width: 901px) {
    .tabs-navigation,
    .tabs-navigation.imbel-subnav,
    .header-content,
    .actions-bar {
        position: relative;
        z-index: 2100; /* acima do z-index da .sidebar (2000) */
    }
}

.form-row .form-group {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group label .required {
    color: var(--danger-color);
    margin-left: 2px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-white);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.form-group input::placeholder {
    color: #adb5bd;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

.modal-footer {
    padding: 15px 25px 25px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-footer .btn {
    padding: 12px 24px;
}

/* ========================================
   ABA CONFIGURAÇÕES
   ======================================== */

.config-sections {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.config-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-xs);
    transition: var(--transition);
    border-left: 4px solid var(--info-color);
}

.config-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.config-card h3 {
    margin: 0 0 14px 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-card:nth-child(2) { border-left-color: #8b5cf6; }
.config-card:nth-child(3) { border-left-color: #22c55e; }
.config-card:nth-child(4) { border-left-color: var(--accent-color); }
.config-card:nth-child(5) { border-left-color: #06b6d4; }

.config-card-danger {
    border-color: #fecaca;
    border-left-color: var(--danger-color);
    background: linear-gradient(135deg, #fff5f5, #fef2f2);
}

.config-card-danger h3 {
    color: var(--danger-color);
}

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

/* ========================================
   FOOTER
   ======================================== */

.footer {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-top: 1px solid var(--border-color);
    padding: 16px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.footer-info {
    display: flex;
    gap: 20px;
}

.footer-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ========================================
   SCROLLBAR PERSONALIZADA
   ======================================== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ========================================
   RESPONSIVIDADE
   ======================================== */

@media (max-width: 1200px) {
    .header-info {
        gap: 10px;
    }
    
    .header-stat {
        padding: 6px 12px;
    }

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

@media (max-width: 992px) {
    .header-info {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-end;
    }
    .header-stat {
        padding: 5px 10px;
        min-width: 75px;
    }
    .header-stat .stat-value {
        font-size: 0.95rem;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 15px 20px;
    }

    .logo-text h1 {
        font-size: 1.1rem;
    }

    .tabs-navigation {
        padding: 0 15px;
    }

    .tab-btn {
        padding: 12px 15px;
        font-size: 0.85rem;
    }

    .actions-bar {
        padding: 15px 20px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }

    .content-area {
        padding: 15px;
    }

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

    table {
        font-size: 0.75rem;
    }

    th, td {
        padding: 8px 5px;
    }

    th.col-produto,
    td.produto-nome {
        min-width: 180px;
        padding-left: 10px;
    }

    .modal-content {
        margin: 5% auto;
        width: 95%;
    }

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

    .footer {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .footer-info {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ========================================
   ANIMAÇÕES
   ======================================== */

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.loading {
    animation: pulse 1.5s infinite;
}

/* ========================================
   UTILITÁRIOS
   ======================================== */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }
.font-bold { font-weight: 600; }
.mt-10 { margin-top: 10px; }
.mb-10 { margin-bottom: 10px; }

/* ========================================
   REGISTRO DE VENDAS
   ======================================== */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 5px;
}

.section-header .section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.section-header .section-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--accent-color);
    border-radius: 2px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Make the section header inside the Estoque tab sticky below the actions bar */
#tab-estoque .section-header {
    position: sticky;
    top: var(--acoes-height, 52px);
    z-index: 1350 !important;
    background: var(--bg-white);
    margin-bottom: 0;
}

/* Ensure thead sticks above body but below section header/actions */
#tab-estoque #tabelaEstoque thead th {
    z-index: 1300 !important;
}

/* Second header row offset uses CSS var set by JS */
#tab-estoque #tabelaEstoque thead tr:nth-child(2) th {
    top: var(--first-row-h, 36px) !important;
}

/* Product column cells should float above body but below header */
#tab-estoque #tabelaEstoque td.produto-nome {
    z-index: 1250 !important;
    background: var(--bg-white) !important;
}

.filtros-container {
    background: var(--bg-white);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filtro-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}

.filtro-group label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.filtro-group select {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
    background-color: var(--bg-white);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
    transition: var(--transition);
}

.filtro-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.btn-sm {
    padding: 10px 16px;
    font-size: 0.85rem;
}

.col-contrato { min-width: 90px; }
.col-loja { min-width: 200px; text-align: left !important; padding-left: 15px !important; }
.col-representante { min-width: 100px; }
.col-produto-venda { min-width: 200px; text-align: left !important; }
.col-qtd { min-width: 70px; }
.col-valor-un { min-width: 110px; }
.col-valor-total { min-width: 120px; }
.col-obs { min-width: 150px; }
.col-acoes { min-width: 80px; }

.tabela-vendas td.col-loja,
.tabela-vendas td.col-produto-venda {
    text-align: left;
    padding-left: 15px;
    font-weight: 500;
}

.tabela-vendas td.col-contrato {
    font-weight: 600;
    color: var(--primary-color);
}

.tabela-vendas td.col-valor-un,
.tabela-vendas td.col-valor-total {
    text-align: right;
    padding-right: 15px;
    font-variant-numeric: tabular-nums;
}

.tabela-vendas td.col-valor-total {
    font-weight: 600;
    color: var(--success-color);
}

.tabela-vendas td.col-obs {
    font-size: 0.8rem;
    color: var(--text-secondary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tabela-vendas th.col-acoes,
.tabela-vendas td.col-acoes {
    position: sticky;
    right: 0;
    background: var(--primary-color);
}

.tabela-vendas td.col-acoes {
    background: var(--bg-white);
}

.tabela-vendas tbody tr:nth-child(even) td.col-acoes {
    background: #f8fafc;
}

.tabela-vendas tbody tr:hover td.col-acoes {
    background: #eef2f7;
}

.row-contrato-resumo {
    background: #eef3f9 !important;
}

.row-contrato-detalhe.hidden-row {
    display: none;
}

.detalhe-vazio {
    background: #fafbfc;
}

.btn-expand-contrato {
    border: none;
    background: transparent;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-align: left;
}

.btn-expand-contrato:hover {
    text-decoration: underline;
}

/* Ajustes compactos para Registro de Vendas */
#tabelaRegistroVendas td {
    padding: 6px 8px;
    line-height: 1.2;
}

#tabelaRegistroVendas .row-contrato-resumo td,
#tabelaRegistroVendas .row-contrato-detalhe td {
    vertical-align: middle;
}

#tabelaRegistroVendas td.col-acoes {
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

#tabelaRegistroVendas td.col-acoes .btn-action {
    padding: 4px 7px;
    font-size: 0.78rem;
    line-height: 1;
}

.btn-action {
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.btn-action.btn-delete {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.btn-action.btn-delete:hover {
    background: var(--danger-color);
    color: white;
}

.table-footer {
    background: linear-gradient(135deg, #e8eef5 0%, #dce4ed 100%);
    padding: 15px 20px;
    border-top: 2px solid var(--primary-color);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 30px;
}

.total-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.total-item .total-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.total-item .total-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.total-item.highlight .total-value {
    color: var(--success-color);
    font-size: 1.3rem;
}

/* Modal grande para venda detalhada */
.modal-lg {
    max-width: 650px;
}

.modal-lg .form-row {
    grid-template-columns: 1fr 1fr;
}

.modal-lg .form-row.triple {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-white);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
    resize: vertical;
    font-family: inherit;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.form-group textarea::placeholder {
    color: #adb5bd;
}

.readonly-field {
    background: #f8fafc !important;
    color: var(--text-secondary) !important;
    cursor: not-allowed;
}

.highlight-field {
    background: rgba(40, 167, 69, 0.1) !important;
    color: var(--success-color) !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state .empty-text {
    font-size: 1rem;
    margin-bottom: 8px;
}

.empty-state .empty-hint {
    font-size: 0.85rem;
    color: #adb5bd;
}

.badge-rep {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-rep.kolte { background: rgba(61, 90, 128, 0.15); color: #3d5a80; }
.badge-rep.isa { background: rgba(92, 77, 125, 0.15); color: #5c4d7d; }
.badge-rep.lc { background: rgba(45, 106, 79, 0.15); color: #2d6a4f; }
.badge-rep.ades { background: rgba(156, 74, 26, 0.15); color: #9c4a1a; }
.badge-rep.fl { background: rgba(123, 45, 38, 0.15); color: #7b2d26; }
.badge-rep.imbel { background: rgba(30, 58, 95, 0.15); color: #1e3a5f; }

/* ===== Melhorias visuais para a tabela de inventário ===== */
/* Destacar cada bloco de 3 colunas por representante com cor suave */
#tabelaEstoque td:nth-child(2),
#tabelaEstoque td:nth-child(3),
#tabelaEstoque td:nth-child(4) {
    background: rgba(61, 90, 128, 0.04);
}

#tabelaEstoque td:nth-child(5),
#tabelaEstoque td:nth-child(6),
#tabelaEstoque td:nth-child(7) {
    background: rgba(92, 77, 125, 0.04);
}

#tabelaEstoque td:nth-child(8),
#tabelaEstoque td:nth-child(9),
#tabelaEstoque td:nth-child(10) {
    background: rgba(45, 106, 79, 0.04);
}

#tabelaEstoque td:nth-child(11),
#tabelaEstoque td:nth-child(12),
#tabelaEstoque td:nth-child(13) {
    background: rgba(156, 74, 26, 0.04);
}

#tabelaEstoque td:nth-child(14),
#tabelaEstoque td:nth-child(15),
#tabelaEstoque td:nth-child(16) {
    background: rgba(123, 45, 38, 0.04);
}

#tabelaEstoque td:nth-child(17),
#tabelaEstoque td:nth-child(18),
#tabelaEstoque td:nth-child(19) {
    background: rgba(30, 58, 95, 0.04);
}

/* Consolidado com fundo neutro mais forte */
#tabelaEstoque td:nth-child(20),
#tabelaEstoque td:nth-child(21),
#tabelaEstoque td:nth-child(22) {
    background: rgba(16, 30, 46, 0.03);
    font-weight: 700;
}

/* Cor por representante usando classes (sobrescreve nth-child quando presente) */
#tabelaEstoque td.rep-kolte { background: rgba(121,192,255,0.04); }
#tabelaEstoque td.rep-isa   { background: rgba(126,231,135,0.04); }
#tabelaEstoque td.rep-lc    { background: rgba(88,166,255,0.04); }
#tabelaEstoque td.rep-ades  { background: rgba(255,166,87,0.04); }
#tabelaEstoque td.rep-fl    { background: rgba(210,168,255,0.04); }
#tabelaEstoque td.rep-imbel { background: rgba(255,123,114,0.04); }

/* Sub-headers coloridos por representante (segunda linha do thead) */
#tabelaEstoque thead tr:nth-child(2) th.rep-kolte { background: rgba(121,192,255,0.22); color: #12324a; }
#tabelaEstoque thead tr:nth-child(2) th.rep-isa   { background: rgba(126,231,135,0.22); color: #123822; }
#tabelaEstoque thead tr:nth-child(2) th.rep-lc    { background: rgba(88,166,255,0.22); color: #12324a; }
#tabelaEstoque thead tr:nth-child(2) th.rep-ades  { background: rgba(255,166,87,0.22); color: #4a260e; }
#tabelaEstoque thead tr:nth-child(2) th.rep-fl    { background: rgba(210,168,255,0.22); color: #3e1c18; }
#tabelaEstoque thead tr:nth-child(2) th.rep-imbel { background: rgba(255,123,114,0.22); color: #0f2740; }

/* Separadores visuais entre blocos */
#tabelaEstoque td:nth-child(4),
#tabelaEstoque td:nth-child(7),
#tabelaEstoque td:nth-child(10),
#tabelaEstoque td:nth-child(13),
#tabelaEstoque td:nth-child(16),
#tabelaEstoque td:nth-child(19) {
    border-right: 3px solid rgba(0,0,0,0.06);
}

/* Sub-headers (segunda linha do thead) com cores correspondentes - mais legível */
#tabelaEstoque thead tr:nth-child(2) th.sub-header {
    font-weight: 700;
    font-size: 0.72rem;
    padding: 10px 8px;
    color: #0f1724; /* texto escuro para contraste */
    text-transform: uppercase;
}

/* Cores de fundo levemente tonais por representante, com contraste maior */
#tabelaEstoque thead tr:nth-child(2) th:nth-child(1),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(2),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(3) { background: rgba(61, 90, 128, 0.22); color: #12324a; }

#tabelaEstoque thead tr:nth-child(2) th:nth-child(4),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(5),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(6) { background: rgba(92, 77, 125, 0.22); color: #2b1b3b; }

#tabelaEstoque thead tr:nth-child(2) th:nth-child(7),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(8),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(9) { background: rgba(45, 106, 79, 0.18); color: #123822; }

#tabelaEstoque thead tr:nth-child(2) th:nth-child(10),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(11),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(12) { background: rgba(156, 74, 26, 0.18); color: #4a260e; }

#tabelaEstoque thead tr:nth-child(2) th:nth-child(13),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(14),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(15) { background: rgba(123, 45, 38, 0.18); color: #3e1c18; }

#tabelaEstoque thead tr:nth-child(2) th:nth-child(16),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(17),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(18) { background: rgba(30, 58, 95, 0.22); color: #0f2740; }

#tabelaEstoque thead tr:nth-child(2) th:nth-child(19),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(20),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(21) { background: rgba(16, 30, 46, 0.12); color: #0b1a2a; }

/* Melhor contraste para números importantes */
#tabelaEstoque td.cell-disp { color: #1f2d3d; }
#tabelaEstoque td.cell-venda { color: #0d6efd; }
#tabelaEstoque td.cell-saldo { color: #198754; }

/* Tornar as colunas de saldo mais visíveis */
#tabelaEstoque td.cell-saldo { font-weight: 700; }

/* Garantir prioridade para saldos negativos (especificidade maior) */
#tabelaEstoque td.cell-saldo.negativo {
    color: var(--danger-color) !important;
    background: rgba(220, 53, 69, 0.08) !important;
    font-weight: 800 !important;
}

/* Garantir animação para negativos com especificidade aumentada */
#tabelaEstoque td.cell-saldo.negativo.animate-negativo {
    animation: pulso-negativo 1.6s ease-in-out infinite !important;
}

/* Reduzir preenchimento horizontal para caber melhor */
#tabelaEstoque td { padding: 8px 6px; }

/* Pequeno ajuste para o cabeçalho principal por representante */
th.header-rep { border-right: 2px solid rgba(255,255,255,0.06); }

/* ========================================
   INVENTÁRIO - Aparência igual ao Relatório
   Uniformiza a tabela de `#tabelaEstoque` para ficar visualmente
   igual à tabela usada no preview/relatório (bordas, padding, alinhamentos).
   ======================================== */

#tabelaEstoque {
    border-collapse: collapse; /* igual ao report-printable */
    font-size: 0.9rem;
}

#tabelaEstoque th,
#tabelaEstoque td {
    border: 1px solid #e6e9ee;
    padding: 8px 10px;
    text-align: center;
}

#tabelaEstoque th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

/* Manter coluna de produto fixa à esquerda e alinhada à esquerda */
#tabelaEstoque th.col-produto,
#tabelaEstoque td.produto-nome {
    text-align: left;
    padding-left: 20px;
    position: sticky;
    left: 0;
    z-index: 951;
    background: var(--bg-white);
}

/* Aumentar destaque do nome do produto na tabela de Inventário */
#tabelaEstoque th.col-produto {
    font-size: 1.05rem; /* maior que o padrão do thead */
    font-weight: 700;
    padding-top: 12px;
    padding-bottom: 12px;
}

#tabelaEstoque td.produto-nome {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1rem; /* texto das células de produto maior */
    font-weight: 600;
    padding-top: 10px;
    padding-bottom: 10px;
}

/* Garantir contraste para a linha de totais e linhas especiais (mantém regras anteriores) */
#tabelaEstoque tr.total-row td {
    border-top: 2px solid var(--primary-color);
}

/* ==============================
   RELATÓRIOS / IMPRESSÃO
   ============================== */

.report-preview {
    background: var(--bg-white);
    padding: 16px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    overflow: auto;
}

.report-preview .report-printable {
    width: 100%;
}

.report-printable table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.report-printable th,
.report-printable td {
    border: 1px solid #e6e9ee;
    padding: 8px 10px;
    text-align: left;
}

/* Centralizar os dados numéricos no preview do Inventário, mas manter a coluna de produtos à esquerda */
.report-printable #tabelaEstoqueRelatorio th,
.report-printable #tabelaEstoqueRelatorio td {
    text-align: center;
}
.report-printable #tabelaEstoqueRelatorio th.col-produto,
.report-printable #tabelaEstoqueRelatorio td.produto-nome {
    text-align: left;
    padding-left: 20px;
}

/* Aumentar fonte no relatório/preview também */
.report-printable #tabelaEstoqueRelatorio th.col-produto {
    font-size: 1.05rem;
    font-weight: 700;
    padding-top: 12px;
    padding-bottom: 12px;
}
.report-printable #tabelaEstoqueRelatorio td.produto-nome {
    font-size: 1rem;
    font-weight: 600;
    padding-top: 10px;
    padding-bottom: 10px;
}

.report-printable thead th {
    background: var(--primary-color);
    color: white;
}

/* Cabeçalho do preview/relatório mantém cor primária */
.report-printable thead th {
    background: var(--primary-color);
    color: white;
}

/* Restaurar cores por representante especificamente na tabela de Inventário
   para facilitar a identificação visual (mesma paleta usada no layout geral). */
#tabelaEstoque thead th {
    border: 1px solid #e6e9ee;
    padding: 8px 10px;
    text-align: center;
    color: #ffffff;
}

/* Cores por representante (mesmas usadas globalmente, aplicadas com maior especificidade)
    para que a tabela de inventario reflita a imagem fornecida. */
/* Garantir que a primeira coluna (PRODUTOS) tenha o mesmo estilo do relatório */
#tabelaEstoque th.col-produto {
     background: var(--primary-dark) !important;
     color: #ffffff !important;
     position: sticky;
     left: 0;
     z-index: 952;
}

#tabelaEstoque thead th.header-rep.kolte { background: #3d5a80 !important; }
#tabelaEstoque thead th.header-rep.isa   { background: #5c4d7d !important; }
#tabelaEstoque thead th.header-rep.lc    { background: #2d6a4f !important; }
#tabelaEstoque thead th.header-rep.ades  { background: #9c4a1a !important; }
#tabelaEstoque thead th.header-rep.fl    { background: #7b2d26 !important; }
#tabelaEstoque thead th.header-rep.imbel { background: #1e3a5f !important; }
#tabelaEstoque thead th.header-geral     { background: var(--primary-dark) !important; }

/* Segunda linha (sub-headers Disp/Venda/Saldo) com as mesmas tonalidades por grupo.
    Aqui usamos seletores por blocos de 3 colunas, começando no primeiro th da segunda linha. */
#tabelaEstoque thead tr:nth-child(2) th.sub-header { color: #ffffff !important; }
#tabelaEstoque thead tr:nth-child(2) th:nth-child(1),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(2),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(3) { background: #3d5a80 !important; }

#tabelaEstoque thead tr:nth-child(2) th:nth-child(4),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(5),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(6) { background: #5c4d7d !important; }

#tabelaEstoque thead tr:nth-child(2) th:nth-child(7),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(8),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(9) { background: #2d6a4f !important; }

#tabelaEstoque thead tr:nth-child(2) th:nth-child(10),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(11),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(12) { background: #9c4a1a !important; }

#tabelaEstoque thead tr:nth-child(2) th:nth-child(13),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(14),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(15) { background: #7b2d26 !important; }

#tabelaEstoque thead tr:nth-child(2) th:nth-child(16),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(17),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(18) { background: #1e3a5f !important; }

#tabelaEstoque thead tr:nth-child(2) th:nth-child(19),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(20),
#tabelaEstoque thead tr:nth-child(2) th:nth-child(21) { background: var(--primary-dark) !important; }

/* Reforçar texto branco nas células do thead da tabela de inventário */
#tabelaEstoque thead th { color: #ffffff !important; }

/* Linha com saldo consolidado zerado */
tr.row-saldo-zero {
    background-color: #fde8e8 !important;
    border-left: 3px solid #dc3545;
}
tr.row-saldo-zero td {
    color: #721c24;
}

/* Forçar sub-headers (segunda linha do thead) a usar as mesmas cores
   dos respectivos representantes (evita conflitos com seletores por nth-child)
   Colocamos no fim para garantir especificidade e aplicação. */
#tabelaEstoque thead tr:nth-child(2) th.rep-isa   { background: #5c4d7d !important; color: #ffffff !important; }
#tabelaEstoque thead tr:nth-child(2) th.rep-kolte { background: #3d5a80 !important; color: #ffffff !important; }
#tabelaEstoque thead tr:nth-child(2) th.rep-ades  { background: #9c4a1a !important; color: #ffffff !important; }
#tabelaEstoque thead tr:nth-child(2) th.rep-fl    { background: #7b2d26 !important; color: #ffffff !important; }
#tabelaEstoque thead tr:nth-child(2) th.rep-lc    { background: #2d6a4f !important; color: #ffffff !important; }
#tabelaEstoque thead tr:nth-child(2) th.rep-imbel { background: #1e3a5f !important; color: #ffffff !important; }

#tabelaEstoque thead tr:nth-child(2) th.sub-header { color: #ffffff !important; }
tr.row-saldo-zero td.produto-nome {
    font-weight: 700;
}
tr.row-saldo-zero .geral-saldo {
    color: #dc3545;
    font-weight: 700;
}

/* Impressão: esconder cabeçalho, navegação e elementos não relacionados ao relatório */
@media print {
    body * { visibility: hidden; }
    .report-printable, .report-printable * { visibility: visible; }
    .report-printable { position: absolute; left: 0; top: 0; width: 100%; }
}

/* ========================================
   CONTROLE DE ENVIO - CAMPOS EDITÁVEIS
   ======================================== */

.campo-editavel {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    background-color: var(--bg-white);
    color: var(--text-primary);
    transition: var(--transition);
}

.campo-editavel:hover {
    border-color: var(--primary-color);
    background-color: #fafbfc;
}

.campo-editavel:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
    background-color: var(--bg-white);
}

.checkbox-campo {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--success-color);
}

.checkbox-campo:hover {
    transform: scale(1.1);
}

/* ========================================
   NOTIFICAÇÕES / TOASTS
   ======================================== */

.notificacao {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    padding: 14px 22px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 500;
    color: white;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.35s cubic-bezier(.4,0,.2,1), fadeOut 0.4s 3.6s forwards;
    max-width: 420px;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(10px);
}

.notificacao.success {
    background: linear-gradient(135deg, #16a34a, #22c55e);
}

.notificacao.error {
    background: linear-gradient(135deg, #dc2626, #ef4444);
}

.notificacao.info {
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
}

.notificacao.warning {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    color: #1e293b;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(60px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; visibility: hidden; }
}

/* ========================================
   SPINNER OVERLAY
   ======================================== */

.spinner-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.col-sistema,
.col-assinado,
.col-enviado,
.col-solicitacao {
    text-align: center;
}

.col-sistema {
    min-width: 100px;
}

.col-solicitacao {
    min-width: 150px;
}

/* ========================================
   BUSCA GLOBAL (HEADER)
   ======================================== */

.header-search {
    flex: 0 0 auto;
    margin: 0 16px;
}

.header-search input {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
    font-size: 0.85rem;
    width: 280px;
    transition: var(--transition);
    outline: none;
}

.header-search input::placeholder {
    color: rgba(255,255,255,0.45);
}

.header-search input:focus {
    background: rgba(255,255,255,0.15);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(201,162,39,0.2);
    width: 340px;
}

/* ========================================
   BUSCA NA TABELA ESTOQUE
   ======================================== */

.input-busca-tabela {
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    width: 250px;
    transition: var(--transition);
    outline: none;
}

.input-busca-tabela:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30,58,95,0.1);
}

/* ========================================
   TRANSIÇÕES DE ABA (FADE)
   ======================================== */

.tab-content {
    display: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.tab-content.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
    animation: fadeSlideIn 0.3s ease;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   MENU HAMBÚRGUER (MOBILE)
   ======================================== */

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px 15px;
    z-index: 101;
    flex-direction: column;
    gap: 5px;
}

.hamburger-btn span {
    display: block;
    width: 24px;
    height: 3px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: var(--transition);
}

.hamburger-btn.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 6px); }
.hamburger-btn.active span:nth-child(2) { opacity: 0; }
.hamburger-btn.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -6px); }

@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
        position: sticky;
        top: 60px;
        background: var(--bg-white);
        border-bottom: 1px solid var(--border-color);
        width: 100%;
    }

    .tabs-navigation {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-white);
        box-shadow: var(--shadow-lg);
        z-index: 99;
        padding: 8px;
        border-bottom: 2px solid var(--border-color);
    }

    .tabs-navigation.mobile-open {
        display: flex;
    }

    .tab-btn {
        padding: 12px 16px;
        border-bottom: none;
        border-left: 3px solid transparent;
        border-radius: var(--radius-sm);
    }

    .tab-btn.active {
        border-left-color: var(--accent-color);
        border-bottom: none;
        background: rgba(30,58,95,0.06);
    }

    .header-search {
        display: none;
    }
}

/* ========================================
   ORDENAÇÃO CLICÁVEL NAS COLUNAS
   ======================================== */

th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

th.sortable:hover {
    background: rgba(255,255,255,0.1);
}

th.sortable .sort-icon {
    font-size: 0.7rem;
    opacity: 0.5;
    margin-left: 4px;
}

th.sortable.sort-asc .sort-icon::after { content: ' ▲'; opacity: 1; }
th.sortable.sort-desc .sort-icon::after { content: ' ▼'; opacity: 1; }

/* ========================================
   PAGINAÇÃO
   ======================================== */

.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 14px 20px;
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    flex-wrap: wrap;
}

.pagination-container .page-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    transition: var(--transition);
}

.pagination-container .page-btn:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination-container .page-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-container .page-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0 10px;
}

.pagination-container select {
    padding: 5px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    margin-left: 8px;
}

/* ========================================
   GRÁFICOS DO DASHBOARD
   ======================================== */

.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.chart-container {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.chart-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 14px;
    padding-left: 10px;
    border-left: 3px solid var(--accent-color);
}

.chart-container canvas {
    max-height: 280px;
}

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

/* ========================================
   PROGRESS BAR (CLOUD)
   ======================================== */

.progress-bar-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(0,0,0,0.08);
    z-index: 10000;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--success-color));
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 0 2px 2px 0;
}

.progress-bar-text {
    position: absolute;
    right: 12px;
    top: 6px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* ========================================
   ALERTA ESTOQUE BAIXO
   ======================================== */

.alerta-estoque-baixo {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9000;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
    border-left: 4px solid #d97706;
    border-radius: var(--radius-md);
    padding: 14px 18px;
    max-width: 380px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    font-size: 0.82rem;
    color: #92400e;
    animation: slideInRight 0.3s ease;
}

.alerta-estoque-baixo .alerta-titulo {
    font-weight: 700;
    font-size: 0.88rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.alerta-estoque-baixo .alerta-item {
    padding: 4px 0;
    border-bottom: 1px solid rgba(217,119,6,0.15);
    display: flex;
    justify-content: space-between;
}

.alerta-estoque-baixo .alerta-close {
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.6;
}

.alerta-estoque-baixo .alerta-close:hover {
    opacity: 1;
}

/* ========================================
   HISTÓRICO DE ALTERAÇÕES
   ======================================== */

.historico-lista {
    max-height: 50vh;
    overflow-y: auto;
}

.historico-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.historico-item:last-child { border-bottom: none; }

.historico-item .hist-data {
    min-width: 140px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
}

.historico-item .hist-tipo {
    min-width: 80px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

.historico-item .hist-tipo.venda { color: var(--success-color); }
.historico-item .hist-tipo.distribuicao { color: var(--info-color); }
.historico-item .hist-tipo.entrada { color: var(--warning-color); }
.historico-item .hist-tipo.exclusao { color: var(--danger-color); }
.historico-item .hist-tipo.importacao { color: #8b5cf6; }

.historico-item .hist-descricao {
    flex: 1;
    color: var(--text-primary);
}

/* ========================================
   RESULTADOS BUSCA GLOBAL
   ======================================== */

.busca-resultados {
    max-height: 60vh;
    overflow-y: auto;
}

.busca-categoria {
    margin-bottom: 16px;
}

.busca-categoria h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.busca-resultado-item {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.88rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.busca-resultado-item:hover {
    background: var(--bg-light);
}

.busca-resultado-item .resultado-aba {
    font-size: 0.72rem;
    background: rgba(30,58,95,0.08);
    padding: 2px 8px;
    border-radius: 10px;
    color: var(--primary-color);
    font-weight: 500;
}

/* ========================================
   EDIT BUTTON STYLE
   ======================================== */

.btn-action.btn-edit {
    background: rgba(14,165,233,0.1);
    color: var(--info-color);
}

.btn-action.btn-edit:hover {
    background: var(--info-color);
    color: white;
}

/* ========================================
   IMBEL MODAL STYLES
   ======================================== */

.imbel-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    z-index: 999;
    transition: opacity 0.3s ease;
}

.imbel-modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.imbel-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.imbel-modal-panel {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    max-width: 600px;

/* ==========================
   IMBEL: Subnav, Toolbar e Header
   ========================== */
.imbel-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px 10px;
    background: var(--sidebar-bg);
}
.imbel-section-header .imbel-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #ff7b72;
}
.imbel-section-header .imbel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #7b2d26;
    box-shadow: 0 0 6px rgba(123, 45, 38, 0.6);
}

.imbel-subnav {
    display: flex;
    gap: 2px;
    padding: 0 20px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid #1e2a38;
}
.imbel-subnav .tab-btn {
    color: #8b949e;
    border-bottom: 3px solid transparent;
    padding: 10px 18px;
    font-size: 0.82rem;
}
.imbel-subnav .tab-btn:hover {
    color: #e6edf3;
    background: rgba(123, 45, 38, 0.08);
}
.imbel-subnav .tab-btn.active {
    color: #ff7b72;
    border-bottom-color: #7b2d26;
    background: rgba(123, 45, 38, 0.12);
}

.imbel-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #ffffff;
    border-bottom: 1px solid #d0d7de;
}
.imbel-toolbar .btn {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 6px;
}

.imbel-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #7b2d26;
    color: #ffffff;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 6px;
}
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideInUp 0.3s ease;
    z-index: 1000;
}

.imbel-modal-overlay.open .imbel-modal-panel {
    animation: slideInUp 0.3s ease;
}

.imbel-modal-overlay:not(.open) .imbel-modal-panel {
    animation: slideOutDown 0.3s ease;
}

@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(20px);
        opacity: 0;
    }
}

.imbel-modal-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.imbel-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.imbel-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.imbel-modal-close:hover {
    opacity: 0.7;
}

.imbel-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.imbel-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: #f8fafc;
    border-radius: 0 0 12px 12px;
}

.imbel-modal-cancel {
    margin: 0 !important;
}

/* ========================================
   UI REFACTOR 2026
   ======================================== */

.sidebar {
    transition: width 0.25s ease, transform 0.25s ease;
}

.sidebar-toggle {
    width: 32px;
    height: 32px;
    border: 1px solid #2b3645;
    border-radius: 8px;
    background: #111826;
    color: #c9d1d9;
    cursor: pointer;
    align-self: flex-start;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.sidebar .logo-text {
    min-width: 0;
    max-width: 138px;
}

.sidebar .logo-text h1 {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.2;
    font-size: 0.96rem;
}

.sidebar .logo-text .subtitle {
    white-space: normal;
    line-height: 1.15;
}

.mobile-topbar {
    display: none;
}

.mobile-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(1, 4, 9, 0.5);
    z-index: 1900;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}

.estoque-kpis {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.estoque-kpis .kpi-card {
    padding: 10px 12px;
    border-radius: 8px;
}

.estoque-kpis .kpi-label {
    font-size: 9px;
    letter-spacing: 0.6px;
}

.estoque-kpis .kpi-value {
    font-size: 16px;
    margin-top: 3px;
}

.estoque-kpis .kpi-subtitle {
    font-size: 10px;
    margin-top: 2px;
}

.kpi-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    transition: var(--transition);
}

.kpi-card:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.kpi-accent { border-left-color: var(--accent-color); }
.kpi-success { border-left-color: var(--success-color); }
.kpi-info { border-left-color: var(--info-color); }
.kpi-danger { border-left-color: var(--danger-color); }

.kpi-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    font-weight: 700;
}

.kpi-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.15;
    margin-top: 5px;
    font-family: var(--font-display);
    font-variant-numeric: tabular-nums;
}

.kpi-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Buttons hierarchy for headers and action bars */
.actions-bar .btn,
.section-header .header-actions .btn {
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: none;
    transform: none;
}

.actions-bar .auth-panel {
    margin-left: 8px;
    background: #ffffff;
    border: 1px solid #d0d7de;
    padding: 4px 8px;
    border-radius: 8px;
}

.actions-bar .auth-panel .btn {
    padding: 6px 10px;
}

.actions-bar .btn:hover,
.section-header .header-actions .btn:hover {
    opacity: 0.85;
    box-shadow: none;
}

.actions-bar .btn::after,
.section-header .header-actions .btn::after {
    display: none;
}

.actions-bar .btn-primary,
.section-header .header-actions .btn-primary {
    background: var(--accent-color);
    border: none;
    color: var(--primary-dark);
}

.actions-bar .btn-primary:hover,
.section-header .header-actions .btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.actions-bar .btn-warning,
.section-header .header-actions .btn-warning,
.section-header .header-actions .btn-success,
.section-header .header-actions .btn-info {
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
}

.actions-bar .btn-outline,
.section-header .header-actions .btn-outline,
.section-header .header-actions .btn-sm {
    background: transparent;
    border: 1px solid #d0d7de;
    color: #57606a;
}

/* Inventory table visual refactor */
#tabelaEstoque thead tr:first-child th {
    background: #0d1117 !important;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #8b949e !important;
}

#tabelaEstoque thead tr:first-child th.header-rep.kolte { color: #79c0ff !important; }
#tabelaEstoque thead tr:first-child th.header-rep.isa { color: #7ee787 !important; }
#tabelaEstoque thead tr:first-child th.header-rep.lc { color: #58a6ff !important; }
#tabelaEstoque thead tr:first-child th.header-rep.ades { color: #ffa657 !important; }
#tabelaEstoque thead tr:first-child th.header-rep.fl { color: #d2a8ff !important; }
#tabelaEstoque thead tr:first-child th.header-rep.imbel { color: #ff7b72 !important; }
#tabelaEstoque thead tr:first-child th.header-geral { color: var(--accent-bright) !important; }

#tabelaEstoque thead tr:nth-child(2) th {
    background: #161b22 !important;
    font-size: 9px;
    font-weight: 400;
    color: #6e7681 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#tabelaEstoque td.numeric-cell {
    font-family: var(--font-mono);
}

#tabelaEstoque td.cell-venda.venda-positiva {
    color: #0969da;
    font-weight: 500;
}

#tabelaEstoque td.cell-saldo.saldo-positivo,
#tabelaEstoque td.geral-saldo.saldo-positivo {
    color: #2da44e;
    font-weight: 600;
}

#tabelaEstoque td.cell-saldo.saldo-zero,
#tabelaEstoque td.geral-saldo.saldo-zero {
    color: #cf222e;
    font-weight: 600;
}

#tabelaEstoque td:nth-child(4),
#tabelaEstoque td:nth-child(7),
#tabelaEstoque td:nth-child(10),
#tabelaEstoque td:nth-child(13),
#tabelaEstoque td:nth-child(16),
#tabelaEstoque td:nth-child(19) {
    border-right: 2px solid #e8ebef;
}

#tabelaEstoque td.geral-disp,
#tabelaEstoque td.geral-venda,
#tabelaEstoque td.geral-saldo {
    background: #fffbf0 !important;
}

#tabelaEstoque tr.row-saldo-zero-all {
    background: #fff8f0 !important;
}

#tabelaEstoque tr.row-saldo-zero-all td.produto-nome {
    position: sticky;
    left: 0;
    z-index: 5;
}

.badge-repor {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    margin-left: 8px;
    border-radius: 20px;
    background: #fff1e6;
    color: #bc4c00;
    font-size: 10px;
    font-weight: 700;
}

#tabelaEstoque tr.total-row {
    background: var(--primary-dark) !important;
}

#tabelaEstoque tr.total-row td {
    color: #ffffff !important;
    background: var(--primary-dark) !important;
    border-top: 1px solid rgba(255,255,255,0.08);
}

#tabelaEstoque tr.total-row td.produto-nome {
    color: var(--accent-bright) !important;
}

/* Dashboard layout cards */
.dashboard-card {
    background: #ffffff;
    border: 1px solid #d0d7de;
    border-radius: 10px;
    padding: 20px;
}

.dashboard-charts-row,
.dashboard-tables-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.dashboard-kpis {
    margin-bottom: 12px;
}

.dashboard-charts-row .chart-container {
    border: 1px solid #d0d7de;
    border-radius: 10px;
    box-shadow: none;
}

/* Controle de envio status circles + progress */
.ctr-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ctr-progress {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 18px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    color: #57606a;
    background: #f6f8fa;
    border: 1px solid #d0d7de;
}

.status-indicator {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #d0d7de;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.status-indicator svg {
    width: 10px;
    height: 10px;
    opacity: 0;
}

.status-indicator.checked {
    background: #2da44e;
    border-color: #2da44e;
}

.status-indicator.checked svg {
    opacity: 1;
}

#tabelaControleEnvio tr.row-envio-completo {
    background: linear-gradient(90deg, #f0fff4 0%, transparent 80%);
}

/* Responsive sidebar modes */
@media (max-width: 1200px) {
    .sidebar {
        width: var(--sidebar-collapsed-width);
        padding: 10px 8px;
        overflow: hidden;
    }

    .sidebar .logo-text,
    .sidebar .nav-group-label,
    .sidebar .nav-text,
    .sidebar .sidebar-footer,
    .sidebar .auth-panel {
        display: none;
    }

    .sidebar .logo-icon {
        width: 34px;
        height: 34px;
        flex: 0 0 34px;
    }

    .sidebar .nav-item {
        justify-content: center;
        padding: 8px 4px;
    }

    .sidebar .nav-item > span:first-child {
        font-size: 0;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #8b949e;
        display: inline-block;
    }

    .sidebar .nav-item.active > span:first-child {
        background: var(--accent-color);
    }

    body.sidebar-expanded .sidebar {
        width: var(--sidebar-width);
        padding: 18px 14px;
    }

    body.sidebar-expanded .sidebar .logo-text,
    body.sidebar-expanded .sidebar .nav-group-label,
    body.sidebar-expanded .sidebar .nav-text,
    body.sidebar-expanded .sidebar .sidebar-footer,
    body.sidebar-expanded .sidebar .auth-panel {
        display: block;
    }

    body.sidebar-expanded .sidebar .nav-item {
        justify-content: flex-start;
        padding: 8px 10px;
    }
}

@media (max-width: 900px) {
    .mobile-topbar {
        position: sticky;
        top: 0;
        z-index: 2100;
        display: flex;
        align-items: center;
        gap: 12px;
        height: 50px;
        padding: 0 12px;
        background: var(--sidebar-bg);
        border-bottom: 1px solid #1e2a38;
    }

    .mobile-menu-btn {
        width: 34px;
        height: 34px;
        border-radius: 6px;
        border: 1px solid #2b3645;
        color: #e6edf3;
        background: #111826;
    }

    .mobile-topbar-title {
        color: #e6edf3;
        font-size: 14px;
        font-weight: 700;
    }

    .sidebar {
        width: 0;
        padding: 0;
        overflow: hidden;
        transform: translateX(-100%);
    }

    body.mobile-sidebar-open .sidebar {
        width: 100%;
        padding: 18px 14px;
        transform: translateX(0);
    }

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

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-charts-row,
    .dashboard-tables-row {
        grid-template-columns: 1fr;
    }

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

    #tabelaEstoque td.produto-nome,
    #tabelaEstoque th.col-produto {
        position: sticky;
        left: 0;
        background: #ffffff;
        z-index: 1;
    }
}

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

/* ========================================
   ESTOQUE CHECKLIST OVERRIDES
   ======================================== */

/* Topbar única da área de estoque */
#acoesEstoque.actions-bar {
    background: #ffffff;
    border-bottom: 1px solid #d0d7de;
    padding: 0 20px;
    height: 52px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 10;
}

#acoesEstoque .actions-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

#acoesEstoque .actions-divider {
    display: none;
}

#acoesEstoque .auth-group {
    margin-left: auto;
}

/* KPI 4 cards pequenos */
.estoque-kpis {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 12px;
}

.estoque-kpis .kpi-card {
    background: #ffffff;
    border: 1px solid #d0d7de;
    border-radius: 10px;
    padding: 12px 16px;
}

.estoque-kpis .kpi-label {
    font-size: 10px;
    text-transform: uppercase;
    color: #8c959f;
    letter-spacing: 0.8px;
}

.estoque-kpis .kpi-value {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
}

/* Sticky checklist */
#tab-estoque,
#tab-estoque .content-area,
#tab-estoque .table-container {
    overflow: visible !important;
}

#tab-estoque .table-wrapper {
    overflow-x: auto !important;
    overflow-y: auto !important;
    width: 100% !important;
    /* permitir que o JS defina max-height dinamicamente; usar fallback com vars */
    max-height: calc(100vh - var(--acoes-height, 52px) - var(--section-height, 0px) - 48px) !important;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

/* ========================================
   STICKY CHECKLIST — VERSÃO CORRIGIDA
   ======================================== */

/* 1. Corrige o overflow do container */
#tab-estoque .table-container {
    overflow: visible !important;
}

/* 2. Scroll horizontal no wrapper */
#tab-estoque .table-wrapper {
    overflow-x: auto !important;
    overflow-y: auto !important;
    width: 100% !important;
    max-height: calc(100vh - var(--acoes-height, 52px) - var(--section-height, 0px) - 48px) !important;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

/* 3. Remove transform do thead que quebra sticky */
#tab-estoque #tabelaEstoque thead {
    transform: none !important;
}

#tab-estoque #tabelaEstoque thead th {
    transform: none !important;
}

/* Correções para a aba Precificação (evita colapso da tabela em viewports menores) */
#tab-precificacao,
#tab-precificacao .content-area,
#tab-precificacao .table-container {
    overflow: visible !important;
}

#tab-precificacao .table-wrapper {
    overflow-x: auto !important;
    overflow-y: auto !important;
    width: 100% !important;
    max-height: calc(100vh - 260px) !important;
}

/* (Regras específicas de precificação removidas junto com as sub-abas Consulta/Comparativo/Rastreabilidade) */

/* 4. th.col-produto fica sticky à esquerda e também fixa no topo (manter top para cabeçalho) */
#tab-estoque #tabelaEstoque th.col-produto {
    position: sticky !important;
    left: 0 !important;
    top: 0 !important;       /* fixo no topo e à esquerda (canto) */
    z-index: 951 !important;
    background: #1a1a2e !important;
}

/* 5. Manter a primeira coluna (PRODUTOS) fixa também no corpo da tabela */
/*    - tornamos os `td.produto-nome` sticky na horizontal (left:0)
     - z-index baixo para ficar abaixo do thead, mas acima das outras células */
#tab-estoque #tabelaEstoque tbody td.produto-nome,
#tab-estoque #tabelaEstoque tr.total-row td.produto-nome {
    position: sticky !important;
    left: 0 !important;
    z-index: 2 !important;
    background: #fff !important;
    border-right: 1px solid var(--border-color) !important;
    box-shadow: 2px 0 6px rgba(11,23,35,0.04) !important;
}
#tab-estoque #tabelaEstoque tr.total-row td:nth-child(4),
#tab-estoque #tabelaEstoque tr.total-row td:nth-child(7),
#tab-estoque #tabelaEstoque tr.total-row td:nth-child(10),
#tab-estoque #tabelaEstoque tr.total-row td:nth-child(13),
#tab-estoque #tabelaEstoque tr.total-row td:nth-child(16),
#tab-estoque #tabelaEstoque tr.total-row td:nth-child(19),
#tab-estoque #tabelaEstoque tr.total-row td:nth-child(22) {
    border-right: 3px solid #cbd5e1 !important;
}

/* Fundo alternado por grupo no tbody */
#tab-estoque #tabelaEstoque tbody td:nth-child(2),
#tab-estoque #tabelaEstoque tbody td:nth-child(3),
#tab-estoque #tabelaEstoque tbody td:nth-child(4) {
    background: transparent !important;
}

#tab-estoque #tabelaEstoque tbody td:nth-child(5),
#tab-estoque #tabelaEstoque tbody td:nth-child(6),
#tab-estoque #tabelaEstoque tbody td:nth-child(7) {
    background: rgba(126,231,135,0.04) !important;
}

#tab-estoque #tabelaEstoque tbody td:nth-child(8),
#tab-estoque #tabelaEstoque tbody td:nth-child(9),
#tab-estoque #tabelaEstoque tbody td:nth-child(10) {
    background: transparent !important;
}

#tab-estoque #tabelaEstoque tbody td:nth-child(11),
#tab-estoque #tabelaEstoque tbody td:nth-child(12),
#tab-estoque #tabelaEstoque tbody td:nth-child(13) {
    background: rgba(255,166,87,0.05) !important;
}

#tab-estoque #tabelaEstoque tbody td:nth-child(14),
#tab-estoque #tabelaEstoque tbody td:nth-child(15),
#tab-estoque #tabelaEstoque tbody td:nth-child(16) {
    background: transparent !important;
}

#tab-estoque #tabelaEstoque tbody td:nth-child(17),
#tab-estoque #tabelaEstoque tbody td:nth-child(18),
#tab-estoque #tabelaEstoque tbody td:nth-child(19) {
    background: rgba(255,123,114,0.04) !important;
}

#tab-estoque #tabelaEstoque tbody td:nth-child(20),
#tab-estoque #tabelaEstoque tbody td:nth-child(21),
#tab-estoque #tabelaEstoque tbody td:nth-child(22) {
    background: #fffbf0 !important;
}

@media (max-width: 900px) {
    .estoque-kpis {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 600px) {
    .estoque-kpis {
        grid-template-columns: 1fr !important;
    }
}

/* ==========================
   Melhorias visuais solicitadas
   ========================== */

/* 1. SIDEBAR — Nav item ativo */
.sidebar .nav-item {
    border-left: 3px solid transparent;
    transition: background 0.18s ease, border-color 0.18s ease;
}
.sidebar .nav-item.active {
    border-left: 3px solid var(--accent-color);
    background: linear-gradient(90deg, rgba(184,146,42,0.1) 0%, transparent 100%);
}
.sidebar .nav-item:hover {
    border-left: 2px solid rgba(184,146,42,0.35);
    background: var(--sidebar-item-hover);
}

/* 2. KPI CARDS — Ícone decorativo de fundo */
.kpi-card {
    position: relative;
    overflow: hidden;
}
.kpi-card::after {
    content: attr(data-icon);
    position: absolute;
    right: 12px;
    bottom: 8px;
    font-size: 3.5rem;
    opacity: 0.06;
    pointer-events: none;
    line-height: 1;
    transform: translateZ(0);
}

/* 3. TABELA DE ESTOQUE — Borda superior colorida por representante */
#tabelaEstoque thead tr:first-child th.header-rep.kolte { border-top: 3px solid var(--rep-kolte); }
#tabelaEstoque thead tr:first-child th.header-rep.isa { border-top: 3px solid var(--rep-isa); }
#tabelaEstoque thead tr:first-child th.header-rep.ades { border-top: 3px solid var(--rep-ades); }
#tabelaEstoque thead tr:first-child th.header-rep.fl { border-top: 3px solid var(--rep-fl); }
#tabelaEstoque thead tr:first-child th.header-rep.imbel { border-top: 3px solid var(--rep-imbel); }
#tabelaEstoque thead tr:first-child th.header-rep.header-geral { border-top: 3px solid var(--accent-color); }

/* 4. BADGES DE REPRESENTANTE — Pílula com ponto colorido */
.badge-rep {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 9px;
    line-height: 1;
}
.badge-rep::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.badge-rep.kolte { background: #dbeafe; color: #1d4ed8; }
.badge-rep.kolte::before { background: #79c0ff; }
.badge-rep.isa { background: #dcfce7; color: #15803d; }
.badge-rep.isa::before { background: #7ee787; }
.badge-rep.ades { background: #fff7ed; color: #c2410c; }
.badge-rep.ades::before { background: #ffa657; }
.badge-rep.fl { background: #faf5ff; color: #7e22ce; }
.badge-rep.fl::before { background: #d2a8ff; }
.badge-rep.imbel { background: #fff1f2; color: #be123c; }
.badge-rep.imbel::before { background: #ff7b72; }

/* 5. HEADER STATS — Agrupamento visual (CSS preparado; aplicar wrapper no HTML se existirem elementos) */
.header-stats-group {
    display: flex;
    gap: 1px;
    background: #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #d0d7de;
}
.header-stats-group .header-stat {
    border-radius: 0;
    box-shadow: none;
    border-right: 1px solid #e2e8f0;
}
.header-stats-group .header-stat:last-child { border-right: none; }

/* 6. NOTIFICAÇÕES / TOASTS — Ícone e borda esquerda */
.notificacao {
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 4px solid rgba(255,255,255,0.4);
    padding-left: 18px;
}
.notificacao::before {
    content: '';
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-right: 6px;
}
.notificacao.success::before { content: '✓'; }
.notificacao.error::before { content: '✕'; }
.notificacao.info::before { content: 'ℹ'; }
.notificacao.warning::before { content: '⚠'; }

/* 7. SCROLLBAR — Mais sutil */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d0d7de; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a8b3c1; }

/* 8. LINHA DE TOTAIS DA TABELA — Contraste */
#tabelaEstoque tr.total-row td { color: #ffffff !important; background: var(--primary-dark) !important; }
#tabelaEstoque tr.total-row td.produto-nome { color: var(--accent-bright) !important; }
#tabelaEstoque tr.total-row td.negative,
#tabelaEstoque tr.total-row td span.negative { color: var(--danger-color) !important; }

/* Fix: total-row congelada no rodapé via tfoot sticky */
#tab-estoque #tabelaEstoque tfoot {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 30 !important;
}

#tab-estoque #tabelaEstoque tfoot tr.total-row td {
    box-shadow: 0 -4px 8px rgba(11,23,35,0.06);
}

#tab-estoque #tabelaEstoque tfoot tr.total-row td.produto-nome {
    z-index: 31 !important;
    background: var(--primary-dark) !important;
}

/* Ajustes para a célula 'PRODUTOS' no header da aba Estoque:
   aumentar fonte e centralizar o conteúdo. */
#tab-estoque #tabelaEstoque th.col-produto {
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    text-align: center !important;
    vertical-align: middle !important;
    padding: 14px 12px !important;
}
#tab-estoque #tabelaEstoque td.produto-nome {
    text-align: left; /* manter nome dos produtos alinhado à esquerda por legibilidade */
}
#tab-estoque #tabelaEstoque th.col-produto .produto-title,
#tab-estoque #tabelaEstoque th.col-produto span {
    display: inline-block;
    width: 100%;
    text-align: center;
}


/* ==========================
   IMBEL: Melhorias na tabela 'Registrar Movimentação'
   ========================== */
#controleImbelMovContainer table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    color: var(--text-primary);
}

#controleImbelMovContainer table thead th {
    padding: 10px 12px !important;
    background: linear-gradient(180deg, var(--primary-dark), var(--primary-color)) !important;
    color: #fff !important;
    text-align: center;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 980;
}

#controleImbelMovContainer table tbody tr {
    transition: background .12s ease, transform .06s ease;
}
#controleImbelMovContainer table tbody tr:hover {
    background: #f1f5f9 !important;
    transform: translateY(-1px);
}

#controleImbelMovContainer table tbody tr:nth-child(odd) { background: #fff !important; }
#controleImbelMovContainer table tbody tr:nth-child(even) { background: #fbfdff !important; }

/* Preservar destaque aplicado inline (DVMK) e adicionar leve borda de destaque */
#controleImbelMovContainer table tbody tr[style*="#fff3cd"] { box-shadow: inset 4px 0 0 0 rgba(241,196,15,0.12); }

#controleImbelMovContainer table td {
    padding: 10px 12px !important;
    border: none !important;
    border-bottom: 1px solid #eef2f7 !important;
    vertical-align: middle;
}

/* ID column compact */
#controleImbelMovContainer table th:first-child,
#controleImbelMovContainer table td:first-child {
    width: 64px; max-width: 64px; text-align: center; white-space: nowrap;
}

/* Tipo badge inside cell (JS injects color for text) */
#controleImbelMovContainer table td > span {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: .82rem;
    font-weight: 700;
    background: rgba(0,0,0,0.04);
}

/* Checkbox visuals */
#controleImbelMovContainer input[type="checkbox"].imbel_table_chk_pag,
#controleImbelMovContainer input[type="checkbox"].imbel_table_chk_ent,
#controleImbelMovContainer input[type="checkbox"].imbel_table_chk_fi {
    width: 18px; height: 18px; cursor: pointer;
    accent-color: var(--accent-color);
}

/* Actions column fixed on the right for easier access */
#controleImbelMovContainer table thead th:last-child { position: sticky; right: 0; z-index: 985; }
#controleImbelMovContainer table td:last-child {
    position: sticky;
    right: 0;
    background: linear-gradient(90deg,#fff,#f8fafc);
    z-index: 984;
    box-shadow: -6px 0 12px rgba(0,0,0,0.03);
    text-align: center;
}

#controleImbelMovContainer td:last-child .btn {
    padding: 6px 8px !important;
    font-size: .78rem !important;
    border-radius: 8px !important;
}

/* Improve inputs/selects inside the filters area */
#controleImbelMovContainer select,
#controleImbelMovContainer input[type="date"],
#controleImbelMovContainer input[type="text"] {
    padding: 8px 10px !important;
    border-radius: 8px !important;
    border: 1px solid #e2e8f0 !important;
    background: #fff;
}

@media (max-width: 900px) {
    #controleImbelMovContainer table thead th { font-size: .72rem; padding: 8px 6px !important; }
    #controleImbelMovContainer table td { padding: 8px 6px !important; font-size: .78rem; }
    #controleImbelMovContainer td:last-child { right: 0; }
}


