/* ==========================================================================
   Omie ERP Design System - Controle de Compras & Gestão Financeira
   ========================================================================== */

:root {
    --omie-navy-dark: #0a192f;
    --omie-navy-primary: #102a45;
    --omie-navy-light: #1b3a5b;
    --omie-blue-primary: #0080c8;
    --omie-blue-hover: #0066a2;
    --omie-blue-light: #e6f4fb;
    --omie-cyan: #00b5e2;
    --omie-green: #00a86b;
    --omie-green-light: #e6f7f0;
    --omie-orange: #ff7a00;
    --omie-orange-light: #fff2e6;
    --omie-red: #e53e3e;
    --omie-red-light: #fde8e8;
    --omie-gray-bg: #f2f5f9;
    --omie-gray-card: #ffffff;
    --omie-gray-border: #dce5ef;
    --omie-text-main: #1e293b;
    --omie-text-muted: #64748b;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--omie-gray-bg) !important;
    color: var(--omie-text-main);
    font-size: 0.84rem;
    letter-spacing: -0.01em;
}

/* --- OMIE TOPBAR HEADER --- */
.omie-topbar {
    background: linear-gradient(90deg, #091c30 0%, #102a45 60%, #163659 100%);
    color: #ffffff;
    height: 52px;
    flex-shrink: 0;
    border-bottom: 2px solid var(--omie-blue-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1040;
}

.omie-logo-badge {
    background: linear-gradient(135deg, #0080c8 0%, #00b5e2 100%);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.95rem;
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(0, 128, 200, 0.4);
}

.omie-search-bar {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-radius: 20px;
    font-size: 0.78rem;
    padding: 4px 14px;
    transition: all 0.2s ease;
}

.omie-search-bar::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.omie-search-bar:focus {
    background: rgba(255, 255, 255, 0.22);
    border-color: var(--omie-cyan);
    color: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 181, 226, 0.25);
}

/* --- ERP MAIN NAV (1º Nível: Setores Principais) --- */
.erp-main-nav {
    background: #001e38;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 2px solid #0080c8;
    padding: 0 16px;
    display: flex;
    align-items: stretch;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}
.erp-main-nav::-webkit-scrollbar {
    display: none;
}

.erp-main-item {
    background: transparent;
    border: none;
    outline: none;
    color: #94a3b8;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    padding: 11px 18px 9px 18px;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    text-decoration: none;
    margin-bottom: -2px;
}

.erp-main-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.erp-main-item.active {
    color: #0080c8;
    background: #ffffff;
    border-bottom: 3px solid #0080c8;
    border-top: 3px solid #0080c8;
    font-weight: 800;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.08);
}

/* --- ERP SUB NAV (2º Nível: Submenus do Setor Ativo) --- */
.erp-sub-nav {
    background: #ffffff;
    border-bottom: 1px solid var(--omie-gray-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    min-height: 44px;
}

.erp-sub-group {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}

/* --- OMIE MODULES NAVBAR (Legado / Sub-itens) --- */
.omie-module-nav {
    background: #ffffff;
    border-bottom: 1px solid var(--omie-gray-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.omie-nav-item {
    color: #475569;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 10px 16px;
    border-bottom: 3px solid transparent;
    transition: all 0.15s ease;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.omie-nav-item:hover {
    color: var(--omie-blue-primary);
    background-color: var(--omie-blue-light);
}

.omie-nav-item.active {
    color: var(--omie-blue-primary);
    border-bottom-color: var(--omie-blue-primary);
    background-color: #f7fbfe;
    font-weight: 700;
}

.omie-nav-item .nav-icon {
    font-size: 1rem;
    transition: transform 0.15s ease;
}

.omie-nav-item:hover .nav-icon {
    transform: scale(1.1);
}

/* --- BOTÕES OMIE --- */
.btn-omie-primary {
    background-color: var(--omie-blue-primary);
    border-color: var(--omie-blue-primary);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 128, 200, 0.25);
    transition: all 0.15s ease;
}
.btn-omie-primary:hover {
    background-color: var(--omie-blue-hover);
    border-color: var(--omie-blue-hover);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 128, 200, 0.35);
}

.btn-omie-success {
    background-color: var(--omie-green);
    border-color: var(--omie-green);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 168, 107, 0.25);
}
.btn-omie-success:hover {
    background-color: #008f5a;
    border-color: #008f5a;
    color: #ffffff;
    transform: translateY(-1px);
}

.btn-xs {
    padding: 3px 8px;
    font-size: 0.74rem;
    border-radius: 5px;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.79rem;
    border-radius: 6px;
}

/* --- CARDS & PAINÉIS OMIE --- */
.card {
    border-radius: 8px !important;
    border: 1px solid var(--omie-gray-border) !important;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.15s ease;
}

.card:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
}

.card-header {
    background-color: #ffffff !important;
    border-bottom: 1px solid var(--omie-gray-border) !important;
    padding: 10px 14px;
}

.omie-section-box {
    background-color: #ffffff;
    border: 1px solid var(--omie-gray-border);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 14px;
}

.omie-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--omie-navy-light);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #edf2f7;
}

/* --- KPI CARDS OMIE --- */
.omie-kpi-card {
    background: #ffffff;
    border: 1px solid var(--omie-gray-border);
    border-radius: 8px;
    padding: 12px 14px;
    position: relative;
    overflow: hidden;
}

.omie-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.omie-kpi-blue::before { background-color: var(--omie-blue-primary); }
.omie-kpi-green::before { background-color: var(--omie-green); }
.omie-kpi-orange::before { background-color: var(--omie-orange); }
.omie-kpi-purple::before { background-color: #8b5cf6; }

.omie-kpi-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

/* --- TABELAS OMIE --- */
.table {
    font-size: 0.81rem;
    margin-bottom: 0;
}

.table thead th {
    background-color: #f8fafc;
    color: #475569;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--omie-gray-border);
    padding: 8px 10px;
}

.table tbody td {
    padding: 8px 10px;
    vertical-align: middle;
    border-bottom: 1px solid #edf2f7;
}

.table-hover tbody tr:hover {
    background-color: var(--omie-blue-light) !important;
}

/* --- BADGES & PÍLULAS DE STATUS OMIE --- */
.badge-pill-omie {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-pendente {
    background-color: var(--omie-orange-light);
    color: #c25e00;
    border: 1px solid #ffd8b3;
}

.badge-pago {
    background-color: var(--omie-green-light);
    color: #007a4d;
    border: 1px solid #b3ebd4;
}

.badge-vencido {
    background-color: var(--omie-red-light);
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* --- TOTALIZADOR DESTAQUE (BLOCO OMIE) --- */
.omie-total-box {
    background: linear-gradient(135deg, #091c30 0%, #102a45 100%);
    color: #ffffff;
    border-radius: 8px;
    padding: 14px 18px;
    border: 1px solid rgba(0, 128, 200, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.omie-total-val {
    font-size: 1.55rem;
    font-weight: 800;
    color: #00e699;
    letter-spacing: -0.5px;
}

/* --- RADIO BUTTONS OMIE --- */
.tipo-mercadoria-radio {
    cursor: pointer;
    border: 1px solid var(--omie-gray-border) !important;
    background-color: #ffffff;
    border-radius: 6px !important;
    transition: all 0.15s ease;
}

.tipo-mercadoria-radio:hover {
    border-color: var(--omie-blue-primary) !important;
    background-color: var(--omie-blue-light) !important;
}

.tipo-mercadoria-radio:has(input:checked) {
    border-color: var(--omie-blue-primary) !important;
    background-color: var(--omie-blue-light) !important;
    color: var(--omie-blue-primary);
    font-weight: 700;
}

/* --- SCROLLBAR --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}


/* --- SEARCHABLE PRODUCT COMBOBOX (HIGH VISIBILITY & EXPANDED) --- */
.search-prod-wrapper {
    min-width: 440px;
    width: 100%;
}
.search-prod-input {
    font-size: 0.88rem !important;
    padding: 0.42rem 0.75rem !important;
    min-height: 38px !important;
    border-radius: 6px 0 0 6px !important;
    font-weight: 500 !important;
    color: #0f172a !important;
    background-color: #ffffff !important;
    border: 1.5px solid #94a3b8 !important;
    transition: all 0.2s ease-in-out !important;
}
.search-prod-input:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2) !important;
    background-color: #ffffff !important;
}
.search-prod-wrapper .input-group > .btn {
    padding: 0.42rem 0.85rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1.5px solid #94a3b8 !important;
    border-left: none !important;
    background: #f1f5f9 !important;
    color: #475569 !important;
    border-radius: 0 6px 6px 0 !important;
}
.search-prod-wrapper .input-group > .btn:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}
.search-prod-list {
    background: #ffffff !important;
    border: 2px solid #2563eb !important;
    border-radius: 8px !important;
    z-index: 99999 !important;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.28) !important;
    min-width: 680px !important;
    max-width: min(960px, 95vw) !important;
    width: max-content !important;
    max-height: 420px !important;
}
.search-prod-item {
    cursor: pointer;
    padding: 10px 14px;
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.12s ease, border-left-color 0.12s ease;
    border-left: 4px solid transparent;
}
.search-prod-item:hover, .search-prod-item.active {
    background-color: #eff6ff !important;
    border-left-color: #2563eb !important;
}
.search-prod-item:last-child {
    border-bottom: none;
}
.search-prod-name {
    color: #0f172a;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.35;
    word-break: break-word;
    white-space: normal;
}

/* Garante que o menu suspenso de busca de produtos nunca seja cortado em nenhuma tabela de compras/estoque/pedidos */
#modalCriarRequisicao .table-responsive,
#modalNovaRequisicaoCompra .table-responsive,
#modalEditarNota .table-responsive,
#modalNovoPedidoCompra .table-responsive,
#modalComposicaoProduto .table-responsive,
#view-nova-compra .table-responsive,
#tabela-itens,
#tabela-itens-req,
#tabela-itens-pedido,
#edit-tabela-itens,
#tabela-rc-itens,
#modalCriarRequisicao .card,
#modalNovaRequisicaoCompra .card,
#modalEditarNota .card,
#modalNovoPedidoCompra .card,
#modalComposicaoProduto .card,
#modalCriarRequisicao .card-body,
#modalNovaRequisicaoCompra .card-body,
#modalEditarNota .card-body,
#modalNovoPedidoCompra .card-body,
#modalComposicaoProduto .card-body {
    overflow: visible !important;
}

/* Modal de Edição e Vínculo de NF super amplo para visualização completa de descrições */
#modalEditarNota .modal-dialog {
    max-width: 96vw !important;
    width: 96vw !important;
    margin: 1rem auto !important;
}
#modalEditarNota .edit-item-desc {
    font-size: 0.85rem;
    font-weight: 500;
}
#modalEditarNota .search-prod-input {
    font-size: 0.88rem;
}
#modalEditarNota table td {
    padding: 0.35rem 0.4rem;
}
.search-prod-wrapper .selected-chip {
    font-size: 0.78rem;
    padding: 4px 10px;
    border-radius: 6px;
    margin-top: 5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    line-height: 1.35;
}
.search-prod-wrapper .selected-chip span {
    word-break: break-word;
    white-space: normal;
}

/* Badges de Vínculo de Itens */
.badge-vinculo-100 {
    background-color: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    font-weight: 600;
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.badge-vinculo-parcial {
    background-color: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
    font-weight: 600;
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.badge-vinculo-pendente {
    background-color: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    font-weight: 600;
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ==========================================================================
   Modern SaaS UI & Hub do Colaborador Styles
   ========================================================================== */

/* Interatividade e Elevação Suave de Cards */
.saas-card-interactive {
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.22s ease;
    border: 1px solid #e2e8f0 !important;
}

.saas-card-interactive:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px -6px rgba(15, 23, 42, 0.08), 0 4px 8px -2px rgba(15, 23, 42, 0.04) !important;
    border-color: #cbd5e1 !important;
}

/* Badges Modernos Estilo Soft Pill (SaaS Design) */
.badge-soft-success {
    background-color: #dcfce7 !important;
    color: #15803d !important;
    border: 1px solid #bbf7d0 !important;
}

.badge-soft-warning {
    background-color: #fef9c3 !important;
    color: #854d0e !important;
    border: 1px solid #fef08a !important;
}

.badge-soft-danger {
    background-color: #fee2e2 !important;
    color: #b91c1c !important;
    border: 1px solid #fecaca !important;
}

.badge-soft-primary {
    background-color: #dbeafe !important;
    color: #1d4ed8 !important;
    border: 1px solid #bfdbfe !important;
}

.badge-soft-info {
    background-color: #e0f2fe !important;
    color: #0369a1 !important;
    border: 1px solid #bae6fd !important;
}

.badge-soft-purple {
    background-color: #f3e8ff !important;
    color: #7e22ce !important;
    border: 1px solid #e9d5ff !important;
}

/* Estilização Refinada de Tabelas */
.table > :not(caption) > * > * {
    padding: 0.65rem 0.75rem;
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

/* Micro-sombras suaves e bordas elegantes para inputs */
.form-control-sm, .form-select-sm {
    border-color: #cbd5e1;
    border-radius: 6px;
}

.form-control-sm:focus, .form-select-sm:focus {
    border-color: #0080c8;
    box-shadow: 0 0 0 3px rgba(0, 128, 200, 0.15);
}

/* ==========================================================================
   SIDEBAR & NOVO LAYOUT DO CORA ERP
   ========================================================================== */
.app-layout {
    display: flex;
    width: 100%;
    height: calc(100vh - 52px);
    max-height: calc(100vh - 52px);
    position: relative;
    overflow: hidden;
}

.app-sidebar {
    width: 250px;
    min-width: 250px;
    background: linear-gradient(180deg, #091c30 0%, #0e2742 100%);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1030;
    user-select: none;
    height: 100%;
    max-height: 100%;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.12);
}

.app-sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem 0.5rem;
}

.app-sidebar-content::-webkit-scrollbar {
    width: 4px;
}
.app-sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.app-content-wrapper {
    flex: 1;
    min-width: 0;
    height: 100%;
    max-height: 100%;
    background-color: var(--omie-gray-bg);
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modo Recolhido (Slim / Collapsed) */
.app-layout.sidebar-collapsed .app-sidebar {
    width: 68px;
    min-width: 68px;
}
.app-layout.sidebar-collapsed .sidebar-text-label,
.app-layout.sidebar-collapsed .sidebar-chevron,
.app-layout.sidebar-collapsed .sidebar-header-title,
.app-layout.sidebar-collapsed .sidebar-subgroup,
.app-layout.sidebar-collapsed .sidebar-badge-count {
    display: none !important;
}
.app-layout.sidebar-collapsed .sidebar-item-btn {
    justify-content: center;
    padding: 10px 0;
    position: relative;
}
.app-layout.sidebar-collapsed .sidebar-item-btn i.nav-icon {
    font-size: 1.15rem;
    margin: 0 !important;
}

/* Itens da Sidebar */
.sidebar-section-title {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: #64748b;
    text-transform: uppercase;
    padding: 0.5rem 0.75rem 0.25rem 0.75rem;
}

.sidebar-item-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    color: #cbd5e1;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.18s ease;
    cursor: pointer;
    text-align: left;
    margin-bottom: 3px;
}

.sidebar-item-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar-item-btn.active {
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.18) 0%, rgba(59, 130, 246, 0.18) 100%);
    color: #38bdf8;
    border-left: 3px solid #00b5e2;
}

.sidebar-chevron {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
    opacity: 0.7;
}
.sidebar-item-btn.expanded .sidebar-chevron {
    transform: rotate(180deg);
}

.sidebar-subgroup {
    padding-left: 0.5rem;
    margin-top: 2px;
    margin-bottom: 6px;
    border-left: 2px solid rgba(56, 189, 248, 0.25);
    margin-left: 1.5rem;
}

.sidebar-sub-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 10px;
    font-size: 0.78rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s ease;
    margin-bottom: 2px;
    cursor: pointer;
}

.sidebar-sub-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-sub-item.active {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    font-weight: 600;
}

/* Rodapé da Sidebar */
.app-sidebar-footer {
    padding: 8px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Mobile & Tablet */
@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        top: 52px;
        left: 0;
        bottom: 0;
        width: 260px !important;
        transform: translateX(-100%);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
        z-index: 1050;
    }
    .app-layout.mobile-sidebar-open .app-sidebar {
        transform: translateX(0);
    }
    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 52px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.65);
        backdrop-filter: blur(2px);
        z-index: 1045;
    }
    .app-layout.mobile-sidebar-open .sidebar-backdrop {
        display: block;
    }
}

/* --- CABEÇALHOS & KPIS FIXOS UNIVERSAIS --- */
.view-header-fixo,
.estoque-header-fixo {
    position: sticky;
    top: -1rem;
    z-index: 1020;
    background-color: var(--omie-gray-bg);
    padding-top: 1rem;
    padding-bottom: 0.35rem;
    margin-top: -1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 0.75rem;
}

/* Tabelas com Rolagem Interna Independente: cabeçalhos/filtros fixos e apenas dados rolando */
.tabela-view-scroll,
.tabela-estoque-scroll,
.tabela-historico-scroll {
    max-height: calc(100vh - 52px - 280px);
    overflow-y: auto;
}

@media (max-height: 800px) {
    .tabela-view-scroll,
    .tabela-estoque-scroll,
    .tabela-historico-scroll {
        max-height: calc(100vh - 52px - 230px);
    }
}

.tabela-view-scroll thead th,
.tabela-estoque-scroll thead th,
.tabela-historico-scroll thead th,
.table-responsive thead.sticky-top th,
.table-responsive thead th.sticky-top,
.table thead.sticky-top th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f8fafc !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}





/* Modal de Detalhes, Anexos e Comentários do Título */
#modalTituloDetalhe {
    z-index: 1065 !important;
}
#modalTituloDetalhe .modal-dialog {
    z-index: 1066 !important;
}

/* --- FIM DO ARQUIVO --- */


/* ============================================================
   RESPONSIVO MOBILE — CORA ERP PWA
   Otimizacoes para smartphones (< 768px) e tablets (< 992px)
   ============================================================ */

/* --- Topbar mobile --- */
@media (max-width: 767.98px) {

    .omie-topbar {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
        gap: 0.25rem !important;
    }

    /* Reduz botao instalar app no mobile - esconde texto */
    #btn-instalar-pwa span {
        display: none;
    }

    #btn-instalar-pwa {
        padding: 0.25rem 0.5rem !important;
    }

}

/* --- Board Kanban mobile --- */
@media (max-width: 991.98px) {

    /* Kanban horizontal scroll — layout de colunas em fila */
    #kanban-board {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        gap: 0.75rem !important;
        padding-bottom: 1rem !important;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    /* Cada coluna Kanban ocupa quase toda a tela no celular */
    .kanban-col {
        min-width: 85vw !important;
        max-width: 90vw !important;
        flex-shrink: 0 !important;
        scroll-snap-align: start;
    }

    /* Cards mais compactos */
    .kanban-card {
        font-size: 0.85rem !important;
    }

}

@media (max-width: 767.98px) {

    /* KPIs em 2 colunas no mobile */
    .kpi-cards-row,
    .row-kpis-tarefas {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem !important;
    }

    /* Filtros de tarefas em coluna */
    .filtros-tarefas-row {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

}

/* --- Modais mobile --- */
@media (max-width: 767.98px) {

    /* Modais ocupam tela cheia no celular */
    .modal-dialog:not(.modal-sm):not(.modal-dialog-centered.modal-sm) {
        margin: 0 !important;
        max-width: 100vw !important;
    }

    .modal-dialog:not(.modal-sm) .modal-content {
        border-radius: 0 !important;
        min-height: 100dvh;
    }

    .modal-dialog-scrollable:not(.modal-sm) {
        height: 100dvh !important;
    }

    /* Tabs em modais: scroll horizontal */
    .modal .nav-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
    }

    .modal .nav-tabs .nav-link {
        white-space: nowrap;
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }

}

/* --- Tabelas mobile --- */
@media (max-width: 767.98px) {

    /* Tabelas com scroll horizontal */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Fonte menor nas tabelas */
    .table {
        font-size: 0.8rem !important;
    }

    .table th,
    .table td {
        padding: 0.35rem 0.5rem !important;
        white-space: nowrap;
    }

}

/* --- Area de conteudo principal mobile --- */
@media (max-width: 767.98px) {

    .app-content {
        padding: 0.75rem !important;
    }

    .view-header-fixo {
        padding-top: 0.5rem !important;
        margin-top: -0.5rem !important;
    }

}

/* --- Botao instalar PWA --- */
#btn-instalar-pwa {
    transition: all 0.2s ease;
}

#btn-instalar-pwa:hover {
    background-color: rgba(255, 193, 7, 0.15) !important;
    transform: scale(1.03);
}

/* Esconde o botao quando PWA ja esta instalado */
#btn-instalar-pwa.pwa-installed {
    display: none !important;
}
