/* SB Admin 2 Custom Styles - Mobile Responsive */

/* ===========================
   Variáveis de Tema
   =========================== */
:root {
    --body-bg: #f8f9fc;
    --body-text: #3a3b45;
    --body-text-muted: #858796;
    --card-bg: #ffffff;
    --card-border: #e3e6f0;
    --card-header-bg: #f8f9fc;
    --topbar-bg: #ffffff;
    --topbar-border: rgba(0, 0, 0, 0.05);
    --footer-bg: #ffffff;
    --footer-border: #e3e6f0;
    --table-header-bg: #f8f9fc;
    --table-border-color: #e3e6f0;
    --scrolltop-bg: rgba(90, 92, 105, 0.8);
    --scrolltop-bg-hover: #5a5c69;
}

/* Tema escuro - aplicado também no html para evitar flash */
html.dark-mode,
body.dark-mode {
    --body-bg: #121212;
    --body-text: #e5e5ea;
    --body-text-muted: #a1a1aa;
    --card-bg: #1e1e24;
    --card-border: #2a2a33;
    --card-header-bg: #22222a;
    --topbar-bg: #18181b;
    --topbar-border: #27272f;
    --footer-bg: #18181b;
    --footer-border: #27272f;
    --table-header-bg: #1f2933;
    --table-border-color: #2d3748;
    --scrolltop-bg: rgba(148, 163, 184, 0.8);
    --scrolltop-bg-hover: #9ca3af;
}

/* Aplicar background escuro imediatamente no html quando dark-mode */
html.dark-mode {
    background-color: #121212;
}

/* Body Background */
body {
    background-color: var(--body-bg);
    overflow-x: hidden;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    /* Melhorar performance em mobile */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevenir seleção acidental de texto em mobile */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    height: 100vh;
    max-height: 100vh;
    position: relative;
}

/* Permitir seleção de texto em campos de entrada e áreas de conteúdo */
input, textarea, select,
.form-control, .form-select,
.tox-edit-area, .tox-edit-area *,
.card-body, .table {
    -webkit-user-select: text;
    user-select: text;
}

/* Sidebar Styles - Desktop padrão */
.sidebar {
    width: 224px;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: linear-gradient(180deg, #4e73df 10%, #224abe 100%);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    font-size: 1rem;
}

/* Sidebar mais escura no modo escuro - aplicado também no html para evitar flash */
html.dark-mode .sidebar,
body.dark-mode .sidebar {
    background: linear-gradient(180deg, #020617 10%, #020617 100%) !important;
}

/* Sidebar Brand - Logo */
.sidebar-brand {
    padding: 1rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 4rem;
}

@media (max-width: 768px) {
    .sidebar-brand-img {
        max-width: 150px;
    }
}

/* Sidebar Overlay para Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
    z-index: 1000;
}

/* Wrapper principal */
#wrapper {
    display: flex;
    height: 100vh;
    max-height: 100vh;
    overflow-x: hidden;
    overflow-y: hidden;
    position: relative;
}

#content-wrapper {
    flex: 1;
    transition: margin-left 0.3s;
    height: 100vh;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    margin-left: 224px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Esconder scrollbar do content-wrapper */
#content-wrapper::-webkit-scrollbar {
    display: none;
}

/* Esconder todas as scrollbars visíveis, mas manter funcionalidade */
* {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

*::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
    background: transparent;
}

/* Container responsivo */
.container-fluid {
    width: 100%;
    max-width: 100%;
    padding: 0 15px;
    overflow-x: hidden;
    overflow-y: visible;
    height: auto;
    min-height: auto;
    box-sizing: border-box;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Garantir que linhas e colunas não causem overflow */
.row {
    margin-left: 0;
    margin-right: 0;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    height: auto;
    min-height: auto;
    box-sizing: border-box;
}

.row > * {
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    height: auto;
    min-height: auto;
    box-sizing: border-box;
}

/* Sidebar Toggled States */
body.sidebar-toggled .sidebar {
    transform: translateX(-100%);
}

body.sidebar-toggled #content-wrapper {
    margin-left: 0;
}

/* Seta para expandir/comprimir sidebar (apenas ícone, sem círculo) */
.sidebar-expand-arrow {
    position: fixed !important;
    top: calc((4.375rem - 40px) / 2) !important;
    left: 10px;
    width: 40px !important;
    height: 40px !important;
    background: transparent;
    border: none;
    color: #1f2937;
    cursor: pointer !important;
    z-index: 10001 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    transition: opacity 0.15s ease;
    opacity: 0.85;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    box-shadow: none;
}

.sidebar-expand-arrow i {
    font-size: 1.35rem;
    transition: none;
}

.sidebar-expand-arrow:hover,
.sidebar-expand-arrow:active {
    opacity: 1;
    transform: none;
    box-shadow: none;
}

.sidebar-expand-arrow:focus {
    outline: none;
    box-shadow: none;
}

/* Aparência em modo escuro: apenas cor do ícone - aplicado também no html para evitar flash */
html.dark-mode .sidebar-expand-arrow,
body.dark-mode .sidebar-expand-arrow {
    background: transparent;
    border: none;
    color: #e5e7eb;
    box-shadow: none;
}

/* Regras de exibição são controladas pelo JavaScript */

@media (max-width: 768px) {
    .sidebar-expand-arrow {
        top: calc((3rem - 44px) / 2) !important;
        left: 10px !important;
        width: 44px !important;
        height: 44px !important;
        z-index: 10001 !important;
        background: transparent !important;
        opacity: 0.85;
        pointer-events: auto !important;
        touch-action: manipulation !important;
        position: fixed !important;
        display: flex !important;
        /* Área de toque maior, mas visualmente apenas o ícone */
    }
    
    .sidebar-expand-arrow i {
        font-size: 1.5rem;
        color: #4e73df;
        text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    }
    
    .sidebar-expand-arrow:hover i {
        color: #224abe;
    }
    
    .sidebar-collapse-arrow {
        top: calc((3rem - 44px) / 2);
        left: 240px;
        width: 44px;
        height: 44px;
        z-index: 10000 !important;
        background: transparent !important;
        opacity: 0.85;
        pointer-events: auto !important;
        /* Área de toque maior, mas visualmente apenas o ícone */
    }
    
    .sidebar-collapse-arrow:hover {
        background: transparent !important;
        opacity: 1;
        transform: none;
    }
    
    .sidebar-collapse-arrow:active {
        opacity: 0.6;
        transform: scale(0.95);
    }
    
    .sidebar-collapse-arrow i {
        font-size: 1.5rem;
        color: #4e73df;
        text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    }
    
    .sidebar-collapse-arrow:hover i {
        transform: translateX(-2px);
        color: #224abe;
    }
    
    /* Remover box-shadow no mobile */
    .sidebar-expand-arrow:focus,
    .sidebar-collapse-arrow:focus {
        box-shadow: none;
        outline: none;
    }
}

.sidebar.show {
    transform: translateX(0) !important;
    z-index: 1001 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    display: block !important;
}

.sidebar-brand {
    height: 4.375rem;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 800;
    padding: 1.5rem 1rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-brand-img {
    max-width: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
    /* Transformar logo azul em branca - sem auto-relevo, apenas mudança de cor */
    filter: brightness(0) invert(1);
    transition: opacity 0.3s ease;
    opacity: 1;
}

.sidebar-brand-img:hover {
    /* Efeito sutil no hover apenas */
    opacity: 0.9;
}

.sidebar-brand-icon {
    font-size: 2rem;
}

.sidebar-brand-text {
    color: rgba(255, 255, 255, 0.8);
}

.sidebar .nav-item .nav-link {
    padding: 1rem;
    width: 100%;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.sidebar .nav-item .nav-link:hover {
    color: rgba(255, 255, 255, 1);
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-item.active .nav-link {
    color: #fff;
    font-weight: 700;
    background-color: rgba(255, 255, 255, 0.15);
}

.sidebar-heading {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    color: rgba(255, 255, 255, 0.4);
    padding: 0 1rem;
    margin-top: 1rem;
}

.sidebar-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin: 0 1rem 1rem;
}


/* Topbar Styles - Desktop padrão */
.topbar {
    height: 4.375rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
    padding: 0;
    background-color: var(--topbar-bg) !important;
    border-bottom: 1px solid var(--topbar-border);
}

.navbar-nav .nav-link {
    color: var(--body-text-muted);
    padding: 0.5rem 1rem;
}

.navbar-nav .nav-link:hover {
    color: var(--body-text);
}

/* Card Styles - Desktop padrão */
.card {
    box-shadow: 0 0.15rem 1.75rem 0 rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    background-color: var(--card-bg);
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    height: auto;
    min-height: auto;
    box-sizing: border-box;
}

.card-header {
    background-color: var(--card-header-bg);
    border-bottom: 1px solid var(--card-border);
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    height: auto;
    min-height: auto;
    box-sizing: border-box;
}

.card-body {
    padding: 1.25rem;
    overflow-x: hidden;
    overflow-y: hidden;
    max-width: 100%;
    height: auto;
    min-height: auto;
    box-sizing: border-box;
}

/* Button Styles - Desktop padrão */
.btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    transition: all 0.2s;
    line-height: 1.5;
    vertical-align: middle;
}

/* Espaçamento e centralização de ícones nos botões */
.btn i[class*="fa-"],
.btn i[class*="fas"],
.btn i[class*="far"],
.btn i[class*="fal"],
.btn i[class*="fab"],
.btn-user i[class*="fa-"],
.btn.btn-user i[class*="fa-"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Remove margem do ícone quando é o único elemento ou último elemento visível */
.btn i[class*="fa-"]:last-child,
.btn-user i[class*="fa-"]:last-child,
.btn.btn-user i[class*="fa-"]:last-child {
    margin-right: 0;
}

/* Se o ícone for seguido de um span com texto, garante o espaçamento */
.btn i[class*="fa-"] + span:not(.d-none) {
    margin-left: 0;
}

/* Garantir que spans dentro de botões estejam alinhados */
.btn span {
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
}

.btn-sm {
    min-height: 32px;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

/* Ajuste de espaçamento para ícones em botões pequenos */
.btn-sm i[class*="fa-"],
.btn-sm i[class*="fas"],
.btn-sm i[class*="far"],
.btn-sm i[class*="fal"],
.btn-sm i[class*="fab"] {
    margin-right: 0.4rem;
    font-size: inherit;
}

.btn-sm i[class*="fa-"]:last-child {
    margin-right: 0;
}

.btn-primary {
    background-color: #4e73df;
    border-color: #4e73df;
}

.btn-primary:hover {
    background-color: #2e59d9;
    border-color: #2653d4;
}

.btn-success {
    background-color: #1cc88a;
    border-color: #1cc88a;
}

.btn-success:hover {
    background-color: #17a673;
    border-color: #169b6b;
}

.btn-info {
    background-color: #36b9cc;
    border-color: #36b9cc;
}

.btn-info:hover {
    background-color: #2c9faf;
    border-color: #2a96a5;
}

.btn-danger {
    background-color: #e74a3b;
    border-color: #e74a3b;
}

.btn-danger:hover {
    background-color: #c0392b;
    border-color: #bd3e31;
}

.btn-secondary {
    background-color: #858796;
    border-color: #858796;
}

.btn-secondary:hover {
    background-color: #717384;
    border-color: #6e6f7e;
}

/* Table Styles - Desktop padrão */
.table {
    color: var(--body-text-muted);
    width: 100%;
    font-size: 0.875rem;
}

.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* Melhorar scroll em mobile */
    overscroll-behavior-x: contain;
    overscroll-behavior-y: contain;
    /* Adicionar sombra sutil para indicar scroll */
    position: relative;
    height: auto;
    min-height: auto;
}

/* Esconder scrollbar do table-responsive */
.table-responsive::-webkit-scrollbar {
    display: none;
}

/* Evitar barra de rolagem horizontal desnecessária */
.table-responsive table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Todas as telas: evitar scroll horizontal */
.table-responsive {
    overflow-x: hidden !important;
}

.table-responsive table {
    table-layout: auto !important;
}

/* Garantir que células não causem overflow */
.table-responsive table td,
.table-responsive table th {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 0;
    white-space: normal;
}

/* Tabela do dashboard: garantir que não gere barra de rolagem */
#clientsTable {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: auto;
}

#clientsTable th,
#clientsTable td {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* Em telas menores, ajustar coluna de ações */
@media (max-width: 768px) {
    #clientsTable th[style*="width: 200px"],
    #clientsTable td[style*="text-align: right"] {
        width: auto !important;
        min-width: 120px;
    }
}

/* Melhorias de performance e acessibilidade */
@media (max-width: 768px) {
    /* Otimizar renderização */
    * {
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    /* Melhorar scroll em tabelas */
    .table-responsive {
        will-change: scroll-position;
    }
    
    /* Reduzir animações em dispositivos com preferência reduzida */
    @media (prefers-reduced-motion: reduce) {
        *,
        *::before,
        *::after {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid var(--table-border-color);
    color: var(--body-text);
    background-color: var(--table-header-bg);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.1rem;
    white-space: nowrap;
    padding: 0.75rem;
}

.table td {
    vertical-align: middle;
    padding: 0.75rem;
}

/* Linhas das tabelas respeitando o tema */
.table tbody tr {
    background-color: var(--card-bg);
    border-color: var(--table-border-color);
}

.table tbody tr:nth-of-type(odd) {
    background-color: color-mix(in srgb, var(--card-bg) 92%, #000 8%);
}

.table tbody tr:hover {
    background-color: color-mix(in srgb, var(--card-bg) 85%, #000 15%);
}

/* Compatibilidade com tabelas listradas do Bootstrap/DataTables */
.table-striped > tbody > tr:nth-of-type(odd),
table.dataTable.stripe tbody tr.odd {
    background-color: color-mix(in srgb, var(--card-bg) 90%, #000 10%);
}

.table-striped > tbody > tr:nth-of-type(even),
table.dataTable.stripe tbody tr.even {
    background-color: var(--card-bg);
}

/* Modo escuro: linhas pares também devem ser escuras */
body.dark-mode .table-striped > tbody > tr:nth-of-type(even),
body.dark-mode table.dataTable.stripe tbody tr.even {
    background-color: #111827 !important;
}

table.dataTable.hover tbody tr:hover,
.table-hover > tbody > tr:hover {
    background-color: color-mix(in srgb, var(--card-bg) 82%, #000 18%);
}

/* Forçar tema escuro nas tabelas (inclui DataTables) - aplicado também no html para evitar flash */
html.dark-mode table,
html.dark-mode .table,
html.dark-mode table.dataTable,
body.dark-mode table,
body.dark-mode .table,
body.dark-mode table.dataTable {
    background-color: transparent !important;
    color: var(--body-text) !important;
}

html.dark-mode table thead th,
html.dark-mode .table thead th,
body.dark-mode table thead th,
body.dark-mode .table thead th {
    background-color: #1f2933 !important;
    color: var(--body-text) !important;
    border-color: #2d3748 !important;
}

html.dark-mode table tbody tr,
html.dark-mode .table tbody tr,
html.dark-mode table.dataTable tbody tr,
body.dark-mode table tbody tr,
body.dark-mode .table tbody tr,
body.dark-mode table.dataTable tbody tr {
    background-color: #111827 !important;
}

html.dark-mode table tbody tr:nth-of-type(odd),
html.dark-mode .table tbody tr:nth-of-type(odd),
html.dark-mode table.dataTable.stripe tbody tr.odd,
body.dark-mode table tbody tr:nth-of-type(odd),
body.dark-mode .table tbody tr:nth-of-type(odd),
body.dark-mode table.dataTable.stripe tbody tr.odd {
    background-color: #020617 !important;
}

/* Linhas pares também em modo escuro - regra geral */
html.dark-mode table tbody tr:nth-of-type(even),
html.dark-mode .table tbody tr:nth-of-type(even),
html.dark-mode table.dataTable.stripe tbody tr.even,
body.dark-mode table tbody tr:nth-of-type(even),
body.dark-mode .table tbody tr:nth-of-type(even),
body.dark-mode table.dataTable.stripe tbody tr.even {
    background-color: #111827 !important;
}

html.dark-mode table tbody tr:hover,
html.dark-mode .table tbody tr:hover,
html.dark-mode table.dataTable.hover tbody tr:hover,
body.dark-mode table tbody tr:hover,
body.dark-mode .table tbody tr:hover,
body.dark-mode table.dataTable.hover tbody tr:hover {
    background-color: #0b1120 !important;
}

html.dark-mode table td,
html.dark-mode table th,
html.dark-mode .table td,
html.dark-mode .table th,
html.dark-mode table.dataTable td,
html.dark-mode table.dataTable th,
body.dark-mode table td,
body.dark-mode table th,
body.dark-mode .table td,
body.dark-mode .table th,
body.dark-mode table.dataTable td,
body.dark-mode table.dataTable th {
    background-color: transparent !important;
    border-color: #1f2933 !important;
    color: var(--body-text) !important;
}

/* Tabelas específicas em modo escuro (clientes, usuários, dispositivos, empresas, relatórios, sessões, conhecimento, artigos) - aplicado também no html */
html.dark-mode #clientsTable,
html.dark-mode #clientsTable tbody,
html.dark-mode #usersTable,
html.dark-mode #usersTable tbody,
html.dark-mode #devicesTable,
html.dark-mode #devicesTable tbody,
html.dark-mode #companiesTable,
html.dark-mode #companiesTable tbody,
html.dark-mode #reportsTable,
html.dark-mode #reportsTable tbody,
html.dark-mode #sessionsTable,
html.dark-mode #sessionsTable tbody,
html.dark-mode #knowledgeFilesTable,
html.dark-mode #knowledgeFilesTable tbody,
html.dark-mode #articlesTable,
html.dark-mode #articlesTable tbody,
body.dark-mode #clientsTable,
body.dark-mode #clientsTable tbody,
body.dark-mode #usersTable,
body.dark-mode #usersTable tbody,
body.dark-mode #devicesTable,
body.dark-mode #devicesTable tbody,
body.dark-mode #companiesTable,
body.dark-mode #companiesTable tbody,
body.dark-mode #reportsTable,
body.dark-mode #reportsTable tbody,
body.dark-mode #sessionsTable,
body.dark-mode #sessionsTable tbody,
body.dark-mode #knowledgeFilesTable,
body.dark-mode #knowledgeFilesTable tbody,
body.dark-mode #articlesTable,
body.dark-mode #articlesTable tbody {
    background-color: transparent !important;
}

body.dark-mode #clientsTable tbody tr,
body.dark-mode #usersTable tbody tr,
body.dark-mode #devicesTable tbody tr,
body.dark-mode #companiesTable tbody tr,
body.dark-mode #reportsTable tbody tr,
body.dark-mode #sessionsTable tbody tr,
body.dark-mode #knowledgeFilesTable tbody tr,
body.dark-mode #articlesTable tbody tr {
    background-color: #111827 !important;
}

body.dark-mode #clientsTable tbody tr:nth-of-type(odd),
body.dark-mode #usersTable tbody tr:nth-of-type(odd),
body.dark-mode #devicesTable tbody tr:nth-of-type(odd),
body.dark-mode #companiesTable tbody tr:nth-of-type(odd),
body.dark-mode #reportsTable tbody tr:nth-of-type(odd),
body.dark-mode #sessionsTable tbody tr:nth-of-type(odd),
body.dark-mode #knowledgeFilesTable tbody tr:nth-of-type(odd),
body.dark-mode #articlesTable tbody tr:nth-of-type(odd) {
    background-color: #020617 !important;
}

/* Linhas pares também em modo escuro */
body.dark-mode #clientsTable tbody tr:nth-of-type(even),
body.dark-mode #usersTable tbody tr:nth-of-type(even),
body.dark-mode #devicesTable tbody tr:nth-of-type(even),
body.dark-mode #companiesTable tbody tr:nth-of-type(even),
body.dark-mode #reportsTable tbody tr:nth-of-type(even),
body.dark-mode #sessionsTable tbody tr:nth-of-type(even),
body.dark-mode #knowledgeFilesTable tbody tr:nth-of-type(even),
body.dark-mode #articlesTable tbody tr:nth-of-type(even) {
    background-color: #111827 !important;
}

body.dark-mode #clientsTable tbody tr:hover,
body.dark-mode #usersTable tbody tr:hover,
body.dark-mode #devicesTable tbody tr:hover,
body.dark-mode #companiesTable tbody tr:hover,
body.dark-mode #reportsTable tbody tr:hover,
body.dark-mode #sessionsTable tbody tr:hover,
body.dark-mode #knowledgeFilesTable tbody tr:hover,
body.dark-mode #articlesTable tbody tr:hover {
    background-color: #0b1120 !important;
}

body.dark-mode #clientsTable tbody td,
body.dark-mode #clientsTable thead th,
/* Tabela de usuários - Layout dinâmico e responsivo */
#usersTable_wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: visible;
}

#usersTable_wrapper .table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: visible;
}

#usersTable {
    width: 100% !important;
    table-layout: auto;
    overflow-x: visible;
    max-width: 100%;
    box-sizing: border-box;
}

#usersTable thead th {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

#usersTable tbody td {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Alinhamento da coluna de ações na tabela de usuários */
#usersTable thead th:last-child {
    text-align: left !important;
    padding-left: 1rem !important;
    min-width: 180px;
    width: auto;
}

#usersTable tbody td:last-child {
    text-align: left !important;
    vertical-align: middle !important;
    padding-left: 1rem !important;
    min-width: 180px;
    width: auto;
}

#usersTable tbody td:last-child .d-flex {
    justify-content: flex-start !important;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* Garantir que os botões na coluna de ações estejam alinhados à esquerda */
#usersTable tbody td:last-child .btn {
    margin-left: 0;
    margin-right: 0.25rem;
    flex-shrink: 0;
}

#usersTable tbody td:last-child form {
    display: inline-block;
    margin-left: 0;
    margin-right: 0.25rem;
    flex-shrink: 0;
}

/* Colunas dinâmicas - alinhadas à esquerda (exceto ações) */
#usersTable thead th:first-child,
#usersTable tbody td:first-child {
    width: auto;
    min-width: 150px;
    max-width: none;
    text-align: left !important;
}

#usersTable thead th:nth-child(2),
#usersTable tbody td:nth-child(2) {
    width: auto;
    min-width: 120px;
    max-width: none;
    text-align: left !important;
}

/* Responsividade para mobile */
@media (max-width: 767px) {
    #usersTable {
        font-size: 0.9rem;
    }
    
    #usersTable thead th,
    #usersTable tbody td {
        padding: 0.5rem 0.4rem !important;
    }
    
    #usersTable tbody td:last-child {
        min-width: auto;
        text-align: left !important;
    }
    
    #usersTable tbody td:last-child .d-flex {
        justify-content: flex-start !important;
    }
    
    #usersTable tbody td:last-child .btn {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
}

body.dark-mode #usersTable tbody td,
body.dark-mode #usersTable thead th,
body.dark-mode #devicesTable tbody td,
body.dark-mode #devicesTable thead th,
body.dark-mode #companiesTable tbody td,
body.dark-mode #companiesTable thead th,
body.dark-mode #reportsTable tbody td,
body.dark-mode #reportsTable thead th,
body.dark-mode #sessionsTable tbody td,
body.dark-mode #sessionsTable thead th,
body.dark-mode #knowledgeFilesTable tbody td,
body.dark-mode #knowledgeFilesTable thead th,
body.dark-mode #articlesTable tbody td,
body.dark-mode #articlesTable thead th {
    background-color: transparent !important;
    border-color: #1f2933 !important;
}

/* Alinhamento correto dos campos na tabela de artigos */
#articlesTable tbody td {
    vertical-align: middle !important;
    padding: 0.75rem !important;
}

#articlesTable tbody td:first-child {
    width: auto;
    min-width: 0;
    max-width: none;
}

#articlesTable tbody td:last-child {
    width: auto;
    min-width: 150px;
    white-space: nowrap;
    text-align: right;
}

#articlesTable tbody td:first-child a {
    display: flex;
    align-items: center;
    width: 100%;
    text-decoration: none;
}

#articlesTable tbody td:first-child a i {
    flex-shrink: 0;
}

#articlesTable tbody td:first-child a strong {
    flex: 1;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: break-word;
}

#articlesTable tbody td:last-child .d-flex {
    justify-content: flex-end;
    align-items: center;
}

/* Ajuste para mobile */
@media (max-width: 767px) {
    #articlesTable tbody td {
        padding: 0.5rem !important;
    }
    
    #articlesTable tbody td:last-child {
        min-width: auto;
        white-space: normal;
    }
    
    #articlesTable tbody td:last-child .d-flex {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
}

/* Painel administrativo - Gerenciar Usuários Global: garantir zebra em modo escuro */
body.dark-mode .global-users-table tbody tr:nth-of-type(odd) {
    background-color: #020617 !important;
}

body.dark-mode .global-users-table tbody tr:nth-of-type(even) {
    background-color: #111827 !important;
}

/* Textos claros em modo escuro para elementos marcados como text-dark - aplicado também no html */
html.dark-mode .text-dark,
html.dark-mode .btn.text-dark,
html.dark-mode .badge.text-dark,
body.dark-mode .text-dark,
body.dark-mode .btn.text-dark,
body.dark-mode .badge.text-dark {
    color: #f9fafb !important;
}

/* Badges de conhecimento/dispositivos em modo escuro - aplicado também no html */
html.dark-mode .badge.bg-info,
html.dark-mode .badge.bg-warning,
html.dark-mode .badge.bg-secondary,
body.dark-mode .badge.bg-info,
body.dark-mode .badge.bg-warning,
body.dark-mode .badge.bg-secondary {
    color: #111827 !important; /* contraste sobre fundo claro da badge */
}

/* Título de "Limpeza Automática Ativa" em modo escuro */
body.dark-mode .cleanup-status-title {
    color: #f9fafb !important;
}

/* Texto de "Período de Retenção" em modo escuro */
body.dark-mode .cleanup-status-text {
    color: #e5e7eb !important;
}

/* Tabela de arquivos de conhecimento - Ajuste dinâmico */
#knowledgeFilesTable {
    width: 100% !important;
    table-layout: auto;
}

#knowledgeFilesTable thead th:first-child {
    min-width: 150px;
    max-width: none;
}

#knowledgeFilesTable thead th:last-child {
    width: 150px;
    min-width: 150px;
    text-align: right;
}

#knowledgeFilesTable tbody td {
    vertical-align: middle !important;
    padding: 0.75rem !important;
}

#knowledgeFilesTable tbody td:first-child {
    word-wrap: break-word;
    word-break: break-word;
    max-width: none;
}

#knowledgeFilesTable thead th:nth-child(2) {
    text-align: center !important;
    position: relative;
    min-width: 160px !important;
    width: auto;
    overflow: visible !important;
}

/* Ajustar seta de ordenação do DataTables na coluna "Última Atualização" */
/* Garantir espaço suficiente para a seta à direita e centralizar o texto */
#knowledgeFilesTable thead th:nth-child(2).sorting,
#knowledgeFilesTable thead th:nth-child(2).sorting_asc,
#knowledgeFilesTable thead th:nth-child(2).sorting_desc {
    padding-right: 35px !important; /* Espaço suficiente para a seta */
    padding-left: 20px !important;
    cursor: pointer;
    text-align: center !important;
    position: relative;
    min-width: 160px !important; /* Largura mínima para garantir visibilidade da seta */
}

/* Ajustar posicionamento das setas padrão do DataTables para ficarem à direita, alinhadas verticalmente */
#knowledgeFilesTable thead th:nth-child(2).sorting:before,
#knowledgeFilesTable thead th:nth-child(2).sorting_asc:before,
#knowledgeFilesTable thead th:nth-child(2).sorting_desc:before {
    right: 10px !important;
    left: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

#knowledgeFilesTable thead th:nth-child(2).sorting:after,
#knowledgeFilesTable thead th:nth-child(2).sorting_asc:after,
#knowledgeFilesTable thead th:nth-child(2).sorting_desc:after {
    right: 10px !important;
    left: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

#knowledgeFilesTable tbody td:nth-child(2) {
    white-space: nowrap;
    text-align: center;
    min-width: 160px !important;
    width: auto;
    vertical-align: middle !important;
    overflow: visible !important;
}

#knowledgeFilesTable tbody td:last-child {
    text-align: right;
    white-space: nowrap;
    min-width: 150px;
}

#knowledgeFilesTable .btn-group {
    justify-content: flex-end;
}

/* Alinhamento de botões na tabela de clientes - Desktop */
#clientsTable td:last-child {
    text-align: right;
    white-space: nowrap;
}

#clientsTable td:last-child .btn-group {
    justify-content: flex-end;
    margin-left: auto;
}

#clientsTable th:last-child {
    text-align: right;
}

/* Login Page */
.bg-gradient-primary {
    background: linear-gradient(180deg, #4e73df 10%, #224abe 100%);
    min-height: 100vh;
    padding: 1rem 0;
    display: flex;
    align-items: center;
}

.bg-login-image {
    background: linear-gradient(135deg, #4e73df 10%, #224abe 100%);
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.login-logo {
    max-width: 300px;
    width: auto;
    height: auto;
    object-fit: contain;
    /* Melhorar qualidade e renderização da imagem - preservar todos os detalhes */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    /* Suavização para melhor qualidade */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Transformar logo azul em branca para o painel lateral azul */
    /* Melhorar contraste e nitidez para preservar detalhes */
    filter: brightness(0) invert(1) contrast(1.15);
    /* Forçar renderização de alta qualidade */
    transform: translateZ(0);
    will-change: filter;
    backface-visibility: hidden;
}

.card.o-hidden {
    overflow: hidden;
}

.form-control-user {
    font-size: 1rem;
    border-radius: 10rem;
    padding: 0.75rem 1rem;
}

.btn-user {
    font-size: 1rem;
    border-radius: 10rem;
    padding: 0.75rem 1rem;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    vertical-align: middle !important;
    gap: 0.5rem !important;
    line-height: 1.5 !important;
}

/* Espaçamento e centralização de ícones no botão de login */
.btn-user i[class*="fa-"],
.btn-user i[class*="fas"],
.btn-user i[class*="far"],
.btn-user i[class*="fal"],
.btn-user i[class*="fab"],
.btn.btn-user i[class*="fa-"],
.btn.btn-primary.btn-user i[class*="fa-"],
button.btn.btn-primary.btn-user i[class*="fa-"] {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-right: 0 !important;
    vertical-align: middle !important;
    flex-shrink: 0 !important;
    line-height: 1.5 !important;
    height: auto !important;
}

/* Garantir que o texto após o ícone também esteja alinhado */
.btn-user span,
.btn-user > *:not(i),
.btn.btn-user span,
.btn.btn-user > *:not(i),
.btn.btn-primary.btn-user span,
.btn.btn-primary.btn-user > *:not(i) {
    display: inline-flex !important;
    align-items: center !important;
    vertical-align: middle !important;
    line-height: 1.5 !important;
    height: auto !important;
}

/* Para o caso de texto direto após o ícone (sem span) */
.btn-user::after,
.btn.btn-user::after {
    content: none !important;
}

/* Form Controls - Desktop padrão */
.form-control,
.form-select {
    font-size: 1rem;
    min-height: 38px;
    padding: 0.5rem 0.75rem;
}

textarea.form-control {
    min-height: 100px;
    font-size: 1rem;
}

/* Inputs e selects em modo escuro - aplicado também no html para evitar flash */
html.dark-mode .form-control,
html.dark-mode .form-select,
html.dark-mode .form-control:focus,
html.dark-mode .form-select:focus,
body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
    background-color: #111827;
    color: var(--body-text);
    border-color: #374151;
}

html.dark-mode .form-control::placeholder,
body.dark-mode .form-control::placeholder {
    color: #6b7280;
}

/* Drop Area Styles */
#drop-area {
    transition: all 0.3s ease;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#drop-area:hover {
    background-color: #f8f9fc;
    border-color: #4e73df !important;
}

/* Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    display: none;
    width: 3rem;
    height: 3rem;
    text-align: center;
    color: #fff;
    background: var(--scrolltop-bg);
    line-height: 3rem;
    border-radius: 50%;
    z-index: 99;
    cursor: pointer;
    transition: all 0.3s;
}

.scroll-to-top:focus,
.scroll-to-top:hover {
    color: white;
    background: var(--scrolltop-bg-hover);
    transform: translateY(-2px);
}

.scroll-to-top i {
    font-weight: 800;
    font-size: 1.2rem;
}

/* Footer */
.sticky-footer {
    flex-shrink: 0;
    background-color: var(--footer-bg);
    border-top: 1px solid var(--footer-border);
    padding: 1rem 0;
    margin-top: auto;
}

/* Dropdowns, modais e alerts em modo escuro - aplicado também no html para evitar flash */
html.dark-mode .dropdown-menu,
body.dark-mode .dropdown-menu {
    background-color: #111827;
    color: var(--body-text);
    border-color: #1f2933;
}

html.dark-mode .dropdown-item,
body.dark-mode .dropdown-item {
    color: var(--body-text-muted);
}

html.dark-mode .dropdown-item:hover,
html.dark-mode .dropdown-item:focus,
body.dark-mode .dropdown-item:hover,
body.dark-mode .dropdown-item:focus {
    color: var(--body-text);
    background-color: #1f2933;
}

html.dark-mode .modal-content,
body.dark-mode .modal-content {
    background-color: #111827;
    color: var(--body-text);
    border-color: #1f2933;
}

html.dark-mode .modal-header,
html.dark-mode .modal-footer,
body.dark-mode .modal-header,
body.dark-mode .modal-footer {
    border-color: #1f2933;
}

html.dark-mode .modal-body,
body.dark-mode .modal-body {
    background-color: #111827;
    color: var(--body-text);
}

html.dark-mode .alert,
body.dark-mode .alert {
    background-color: #111827;
    color: var(--body-text);
    border-color: #1f2933;
}

html.dark-mode .alert-success,
body.dark-mode .alert-success {
    background-color: #064e3b;
    border-color: #166534;
    color: #d1fae5;
}

html.dark-mode .alert-danger,
html.dark-mode .alert-error,
body.dark-mode .alert-danger,
body.dark-mode .alert-error {
    background-color: #7f1d1d;
    border-color: #b91c1c;
    color: #fee2e2;
}

html.dark-mode .alert-warning,
body.dark-mode .alert-warning {
    background-color: #78350f;
    border-color: #92400e;
    color: #fef3c7;
}

html.dark-mode .alert-info,
body.dark-mode .alert-info {
    background-color: #0c4a6e;
    border-color: #0369a1;
    color: #cffafe;
}

/* Text Colors */
.text-gray-600 {
    color: var(--body-text-muted) !important;
}

.text-gray-400 {
    color: #d1d3e2 !important;
}

.text-gray-300 {
    color: #dddfeb !important;
}

/* Ícones dos indicadores (cards de estatísticas) - usar mesma cor do texto */
.card.border-left-primary .fa-2x,
.card.border-left-success .fa-2x,
.card.border-left-info .fa-2x,
.card.border-left-warning .fa-2x {
    color: var(--body-text) !important;
}

/* No modo escuro, garantir que os ícones também usem a cor do texto */
body.dark-mode .card.border-left-primary .fa-2x,
body.dark-mode .card.border-left-success .fa-2x,
body.dark-mode .card.border-left-info .fa-2x,
body.dark-mode .card.border-left-warning .fa-2x {
    color: var(--body-text) !important;
}

.text-gray-800 {
    color: var(--body-text) !important;
}

.text-gray-900 {
    color: var(--body-text) !important;
}

/* Texto "muted" mais claro em modo escuro (ex.: período de retenção / última limpeza) */
body.dark-mode .text-muted,
body.dark-mode .small.text-muted {
    color: #9ca3af !important;
}

/* Page Heading - Desktop padrão */
.h3 {
    font-size: 1.75rem;
    font-weight: 400;
}

h1.h3 {
    font-size: 1.75rem;
    font-weight: 400;
}

/* Utility Classes */
.shadow {
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15) !important;
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem 0 rgba(58, 59, 69, 0.2) !important;
}

/* Card do editor de conhecimento - Responsivo e dinâmico */
#knowledgeEditorCard {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
}

#knowledgeEditorBody {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

#knowledgeEditorBody form {
    width: 100%;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

#knowledgeEditorBody textarea#knowledge,
#knowledgeEditorBody .tox-tinymce {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

/* Editor TinyMCE - Container dinâmico */
#knowledgeEditorBody .tox-tinymce {
    width: 100% !important;
    max-width: 100% !important;
}

#knowledgeEditorBody .tox-edit-area {
    width: 100% !important;
    max-width: 100% !important;
}

#knowledgeEditorBody .tox-edit-area iframe {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
}

/* ============================================
   TABLET STYLES (768px - 992px)
   ============================================ */

@media (min-width: 769px) and (max-width: 992px) {
    /* Ajustes leves para tablets */
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        min-height: 36px;
        padding: 0.45rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .btn-sm {
        min-height: 32px;
        padding: 0.35rem 0.65rem;
        font-size: 0.8rem;
    }
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

@media (max-width: 768px) {
    /* Tamanho de fonte base em mobile */
    html {
        font-size: 14px;
    }
    
    body {
        font-size: 14px;
    }
    
    /* Sidebar em Mobile */
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        font-size: 0.9rem;
    }
    
    .sidebar.show {
        transform: translateX(0) !important;
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.3);
        z-index: 1001 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        display: block !important;
    }
    
    .sidebar-brand {
        height: 3.5rem;
        padding: 1rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .sidebar .nav-item .nav-link {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
    
    #content-wrapper {
        margin-left: 0;
    }
    
    /* Topbar ajustes */
    .topbar {
        padding: 0.4rem 0;
        height: 3.5rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }
    
    /* Cards */
    .card {
        margin-bottom: 0.75rem;
    }
    
    /* Card do editor de conhecimento - Dinâmico e autoajustável */
    #knowledgeEditorCard {
        width: 100%;
        max-width: 100%;
        margin-bottom: 0.75rem;
    }
    
    #knowledgeEditorBody {
        width: 100%;
        padding: 0.75rem;
        overflow-x: hidden;
    }
    
    /* Editor TinyMCE responsivo */
    #knowledgeEditorBody .tox-tinymce,
    #knowledgeEditorBody .tox-edit-area {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    #knowledgeEditorBody iframe {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Textarea do editor também responsivo */
    #knowledgeEditorBody textarea#knowledge {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
    }
    
    .card-header {
        padding: 0.6rem 0.75rem;
        font-size: 14px;
    }
    
    .card-body {
        padding: 0.75rem;
        font-size: 14px;
    }
    
    /* Tabelas */
    .table {
        font-size: 14px;
    }
    
    .table thead th {
        font-size: 13px;
        padding: 0.4rem 0.5rem;
    }
    
    .table td {
        padding: 0.4rem 0.5rem;
        font-size: 14px;
    }
    
    /* Visualização em cards para tabelas (mobile muito pequeno) */
    .table-card-view {
        display: none;
    }
    
    @media (max-width: 576px) {
        /* Ocultar tabela tradicional e mostrar cards */
        .table-responsive.has-card-view table {
            display: none;
        }
        
        .table-card-view {
            display: block;
        }
        
        .table-card {
            background: var(--card-bg);
            border: 1px solid var(--card-border);
            border-radius: 8px;
            padding: 1rem;
            margin-bottom: 0.75rem;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }
        
        .table-card-header {
            font-weight: 600;
            font-size: 1rem;
            margin-bottom: 0.75rem;
            padding-bottom: 0.5rem;
            border-bottom: 1px solid var(--card-border);
        }
        
        .table-card-row {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            padding: 0.5rem 0;
            border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        }
        
        .table-card-row:last-child {
            border-bottom: none;
        }
        
        .table-card-label {
            font-weight: 500;
            font-size: 0.85rem;
            color: var(--body-text-muted);
            min-width: 40%;
            margin-right: 0.5rem;
        }
        
        .table-card-value {
            flex: 1;
            text-align: right;
            font-size: 0.9rem;
            word-break: break-word;
        }
        
        .table-card-value code {
            font-size: 0.85rem;
            padding: 0.2rem 0.4rem;
            background: rgba(0, 0, 0, 0.05);
            border-radius: 4px;
            word-break: break-all;
        }
        
        .table-card-actions {
            margin-top: 0.75rem;
            padding-top: 0.75rem;
            border-top: 1px solid var(--card-border);
            display: flex;
            gap: 0.5rem;
            justify-content: flex-end;
        }
        
        .table-card-actions .btn {
            min-width: 44px;
            min-height: 44px;
        }
        
        .table-card-actions form {
            display: inline;
        }
        
        /* Modo escuro para cards de tabela */
        html.dark-mode .table-card,
        body.dark-mode .table-card {
            background-color: #1e1e24 !important;
            border-color: #2a2a33 !important;
        }
        
        html.dark-mode .table-card-header,
        body.dark-mode .table-card-header {
            border-bottom-color: #2a2a33 !important;
            color: #e5e5ea !important;
        }
        
        html.dark-mode .table-card-row,
        body.dark-mode .table-card-row {
            border-bottom-color: rgba(255, 255, 255, 0.05) !important;
        }
        
        html.dark-mode .table-card-label,
        body.dark-mode .table-card-label {
            color: #a1a1aa !important;
        }
        
        html.dark-mode .table-card-value,
        body.dark-mode .table-card-value {
            color: #e5e5ea !important;
        }
        
        html.dark-mode .table-card-value code,
        body.dark-mode .table-card-value code {
            background: rgba(255, 255, 255, 0.1) !important;
            color: #e5e5ea !important;
        }
        
        html.dark-mode .table-card-actions,
        body.dark-mode .table-card-actions {
            border-top-color: #2a2a33 !important;
        }
    }
    
    /* Botões - Áreas de toque otimizadas para mobile */
    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 0.5rem 0.75rem;
        font-size: 14px;
        line-height: 1.4;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
    
    .btn-sm {
        min-height: 38px;
        min-width: 38px;
        padding: 0.4rem 0.6rem;
        font-size: 13px;
        line-height: 1.4;
        touch-action: manipulation;
    }
    
    /* Feedback visual em toque */
    .btn:active {
        opacity: 0.8;
        transform: scale(0.97);
    }
    
    .btn i {
        font-size: 0.9em;
    }
    
    .btn-sm i {
        font-size: 0.9em;
    }
    
    /* Botões apenas com ícones no mobile - estilo elegante e minimalista */
    .btn span:not(.d-none):not(.d-md-inline):not(.d-lg-inline),
    .btn .d-md-none,
    .btn .d-sm-none {
        display: none !important;
    }
    
    /* Remover padding extra e tornar botões circulares quando só tem ícone */
    .btn:not(.btn-user):not(.w-100):not(.dropdown-toggle) {
        padding: 0.5rem !important;
        border-radius: 50% !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        min-width: 44px;
        width: 44px;
        height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Ícones maiores e centralizados */
    .btn:not(.btn-user):not(.w-100):not(.dropdown-toggle) i[class*="fa-"] {
        margin: 0 !important;
        font-size: 1.3rem !important;
        line-height: 1;
    }
    
    /* Cores dos ícones baseadas no tipo de botão */
    .btn-primary:not(.w-100):not(.dropdown-toggle) {
        color: #4e73df !important;
    }
    
    .btn-primary:not(.w-100):not(.dropdown-toggle):hover,
    .btn-primary:not(.w-100):not(.dropdown-toggle):active,
    .btn-primary:not(.w-100):not(.dropdown-toggle):focus {
        background: rgba(78, 115, 223, 0.1) !important;
        color: #224abe !important;
        transform: scale(1.08);
    }
    
    .btn-success:not(.w-100):not(.dropdown-toggle) {
        color: #1cc88a !important;
    }
    
    .btn-success:not(.w-100):not(.dropdown-toggle):hover,
    .btn-success:not(.w-100):not(.dropdown-toggle):active,
    .btn-success:not(.w-100):not(.dropdown-toggle):focus {
        background: rgba(28, 200, 138, 0.1) !important;
        color: #17a673 !important;
        transform: scale(1.08);
    }
    
    .btn-info:not(.w-100):not(.dropdown-toggle) {
        color: #36b9cc !important;
    }
    
    .btn-info:not(.w-100):not(.dropdown-toggle):hover,
    .btn-info:not(.w-100):not(.dropdown-toggle):active,
    .btn-info:not(.w-100):not(.dropdown-toggle):focus {
        background: rgba(54, 185, 204, 0.1) !important;
        color: #2c9faf !important;
        transform: scale(1.08);
    }
    
    .btn-danger:not(.w-100):not(.dropdown-toggle) {
        color: #e74a3b !important;
    }
    
    .btn-danger:not(.w-100):not(.dropdown-toggle):hover,
    .btn-danger:not(.w-100):not(.dropdown-toggle):active,
    .btn-danger:not(.w-100):not(.dropdown-toggle):focus {
        background: rgba(231, 74, 59, 0.1) !important;
        color: #c0392b !important;
        transform: scale(1.08);
    }
    
    .btn-warning:not(.w-100):not(.dropdown-toggle) {
        color: #f6c23e !important;
    }
    
    .btn-warning:not(.w-100):not(.dropdown-toggle):hover,
    .btn-warning:not(.w-100):not(.dropdown-toggle):active,
    .btn-warning:not(.w-100):not(.dropdown-toggle):focus {
        background: rgba(246, 194, 62, 0.1) !important;
        color: #dda20a !important;
        transform: scale(1.08);
    }
    
    .btn-secondary:not(.w-100):not(.dropdown-toggle) {
        color: #858796 !important;
    }
    
    .btn-secondary:not(.w-100):not(.dropdown-toggle):hover,
    .btn-secondary:not(.w-100):not(.dropdown-toggle):active,
    .btn-secondary:not(.w-100):not(.dropdown-toggle):focus {
        background: rgba(133, 135, 150, 0.1) !important;
        color: #717384 !important;
        transform: scale(1.08);
    }
    
    /* Botões pequenos também apenas ícones */
    .btn-sm:not(.w-100):not(.dropdown-toggle) {
        min-width: 40px;
        width: 40px;
        height: 40px;
        padding: 0.4rem !important;
    }
    
    .btn-sm:not(.w-100):not(.dropdown-toggle) i[class*="fa-"] {
        font-size: 1.1rem !important;
    }
    
    /* Botões w-100 (largura total) mantêm estilo normal */
    .btn.w-100 {
        border-radius: 0.35rem !important;
        background: var(--bs-btn-bg) !important;
        border: 1px solid var(--bs-btn-border-color) !important;
        color: var(--bs-btn-color) !important;
        padding: 0.5rem 1rem !important;
        width: 100% !important;
        min-width: auto !important;
    }
    
    /* Botão de usuário (dropdown) mantém estilo */
    .btn-user,
    .dropdown-toggle {
        border-radius: 0.35rem !important;
        background: transparent !important;
    }
    
    /* Botões em modal-footer também apenas ícones no mobile */
    .modal-footer .btn:not(.w-100):not(.dropdown-toggle) {
        padding: 0.5rem !important;
        border-radius: 50% !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        min-width: 44px;
        width: 44px;
        height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    .modal-footer .btn-sm:not(.w-100):not(.dropdown-toggle) {
        min-width: 40px;
        width: 40px;
        height: 40px;
        padding: 0.4rem !important;
    }
    
    .modal-footer .btn:not(.w-100):not(.dropdown-toggle) i[class*="fa-"] {
        margin: 0 !important;
        font-size: 1.3rem !important;
    }
    
    .modal-footer .btn-sm:not(.w-100):not(.dropdown-toggle) i[class*="fa-"] {
        font-size: 1.1rem !important;
    }
    
    /* Transições suaves */
    .btn:not(.w-100):not(.dropdown-toggle) {
        transition: all 0.2s ease;
    }
    
    /* Formulários - Mobile */
    .form-control,
    .form-select {
        font-size: 16px; /* Evita zoom automático no iOS */
        min-height: 40px;
        padding: 0.4rem 0.6rem;
    }
    
    textarea.form-control {
        font-size: 16px; /* Evita zoom automático no iOS */
        padding: 0.4rem 0.6rem;
    }
    
    .form-label {
        font-size: 14px;
        margin-bottom: 0.3rem;
    }
    
    .form-check-label {
        font-size: 14px;
    }
    
    small, .small {
        font-size: 13px;
    }
    
    /* Container */
    .container-fluid {
        padding: 0 0.6rem;
    }
    
    /* Headings */
    .h3 {
        font-size: 1.3rem;
    }
    
    h1.h3 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    h6 {
        font-size: 14px;
    }
    
    p {
        font-size: 14px;
    }
    
    /* Page Heading */
    .d-sm-flex {
        flex-wrap: wrap;
        gap: 0.4rem;
        margin-bottom: 0.75rem !important;
    }
    
    /* Login Page */
    .bg-gradient-primary {
        padding: 0.4rem 0;
    }
    
    .bg-gradient-primary .card {
        margin: 0.4rem 0;
    }
    
    .bg-gradient-primary .p-5 {
        padding: 1.25rem !important;
    }
    
    .form-control-user {
        font-size: 16px;
        padding: 0.5rem 0.75rem;
    }
    
    .btn-user {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.5rem !important;
        line-height: 1.5 !important;
    }
    
    .btn-user i[class*="fa-"],
    .btn.btn-user i[class*="fa-"],
    .btn.btn-primary.btn-user i[class*="fa-"],
    button.btn.btn-primary.btn-user i[class*="fa-"] {
        margin-right: 0 !important;
        line-height: 1.5 !important;
        height: auto !important;
        display: inline-flex !important;
        align-items: center !important;
    }
    
    .btn-user span,
    .btn-user > *:not(i) {
        display: inline-flex !important;
        align-items: center !important;
        line-height: 1.5 !important;
        height: auto !important;
    }
    
    /* Drop Area */
    #drop-area {
        min-height: 100px;
        padding: 1rem 0.75rem;
    }
    
    #drop-area i {
        font-size: 1.75rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    #drop-area p {
        font-size: 0.85rem;
        margin-bottom: 0;
    }
    
    /* Scroll to Top */
    .scroll-to-top {
        width: 2.5rem;
        height: 2.5rem;
        line-height: 2.5rem;
        right: 0.6rem;
        bottom: 0.6rem;
        font-size: 0.9rem;
}

/* Footer */
.sticky-footer {
        padding: 0.5rem 0;
        font-size: 14px;
    }
    
    /* Navbar */
    .navbar-nav .nav-link {
        font-size: 14px;
    }
    
    /* Sidebar */
    .sidebar .nav-item .nav-link {
        font-size: 14px;
    }
    
    .sidebar-brand-text {
        font-size: 14px;
    }
    
    /* Modals */
    .modal-dialog {
        margin: 0.4rem;
    }
    
    .modal-content {
        border-radius: 0.4rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 0.75rem;
    }
    
    .modal-title {
        font-size: 1rem;
    }
    
    /* Alerts */
    .alert {
        padding: 0.6rem 0.75rem;
        font-size: 14px;
        margin-bottom: 0.75rem;
    }
    
    /* Badges */
    .badge {
        font-size: 13px;
        padding: 0.25rem 0.5rem;
    }
    
    .text-muted {
        font-size: 14px;
    }
    
    code {
        font-size: 13px;
    }
    
    /* Spacing reduzido */
    .mb-4 {
        margin-bottom: 0.75rem !important;
    }
    
    .mb-3 {
        margin-bottom: 0.6rem !important;
    }
    
    .mt-3 {
        margin-top: 0.6rem !important;
    }
    
    .py-3 {
        padding-top: 0.6rem !important;
        padding-bottom: 0.6rem !important;
    }
    
    .px-3 {
        padding-left: 0.6rem !important;
        padding-right: 0.6rem !important;
    }
}

@media (max-width: 576px) {
    /* Tamanho de fonte em telas muito pequenas */
    html {
        font-size: 14px;
    }
    
    body {
        font-size: 14px;
    }
    
    .container-fluid {
        padding: 0 0.5rem;
    }
    
    .card-header {
        padding: 0.5rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .card-body {
        padding: 0.6rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.4rem;
        min-height: 44px;
        padding: 0.5rem 0.6rem;
        font-size: 14px;
        line-height: 1.4;
        touch-action: manipulation;
    }
    
    .btn-sm {
        min-height: 38px;
        padding: 0.4rem 0.5rem;
        font-size: 13px;
        line-height: 1.4;
        touch-action: manipulation;
    }
    
    .btn i {
        font-size: 0.8em;
    }
    
    .btn-sm i {
        font-size: 0.8em;
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
        gap: 0.2rem;
    }
    
    .btn-group .btn {
        margin-bottom: 0;
    }
    
    .btn-group.flex-wrap {
        flex-direction: row;
        gap: 0.25rem;
    }
    
    .btn-group.flex-wrap .btn {
        margin-bottom: 0;
    }
    
    /* Alinhamento de botões na tabela de clientes */
    #clientsTable td:last-child {
        text-align: right !important;
    }
    
    #clientsTable td:last-child .btn-group {
        justify-content: flex-end;
        margin-left: auto;
    }
    
    #clientsTable th:last-child {
        text-align: right !important;
    }
    
    .table {
        font-size: 0.75rem;
    }
    
    .table thead th {
        font-size: 0.65rem;
        padding: 0.3rem 0.4rem;
    }
    
    .table td {
        padding: 0.3rem 0.4rem;
    }
    
    /* Tabela de arquivos de conhecimento - Mobile dinâmico */
    #knowledgeFilesTable {
        width: 100% !important;
        font-size: 14px;
    }
    
    #knowledgeFilesTable thead th,
    #knowledgeFilesTable tbody td {
        padding: 0.5rem 0.4rem;
    }
    
    #knowledgeFilesTable tbody td:first-child {
        word-wrap: break-word;
        word-break: break-word;
        white-space: normal;
        max-width: 100%;
    }
    
    #knowledgeFilesTable tbody td:last-child {
        text-align: right;
        white-space: nowrap;
    }
    
    #knowledgeFilesTable .btn-group {
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .h3 {
        font-size: 1.15rem;
    }
    
    h1.h3 {
        font-size: 1rem;
    }
    
    /* Sidebar mais estreita em telas muito pequenas */
    .sidebar {
        width: 240px;
        font-size: 0.85rem;
    }
    
    .sidebar-brand {
        padding: 0.75rem 0.6rem;
        font-size: 0.8rem;
        height: 3rem;
    }
    
    .sidebar .nav-item .nav-link {
        padding: 0.6rem;
        font-size: 0.8rem;
    }
    
    /* Formulários em coluna única */
    .row .col-md-6,
    .row .col-md-4,
    .row .col-md-3 {
        margin-bottom: 0.75rem;
    }
    
    .form-control,
    .form-select {
        font-size: 16px; /* Mantém 16px para evitar zoom no iOS */
        min-height: 38px;
        padding: 0.35rem 0.5rem;
    }
    
    .form-label {
        font-size: 14px;
    }
    
    .form-check-label {
        font-size: 14px;
    }
    
    /* Topbar menor */
    .topbar {
        height: 3rem;
        padding: 0.3rem 0;
    }
    
    /* Modals menores */
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 0.6rem;
    }
    
    .modal-title {
        font-size: 0.95rem;
    }
}

/* Landscape orientation adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    html {
        font-size: 13px;
    }
    
    .sidebar {
        width: 220px;
    }
    
    .topbar {
        height: 3rem;
    }
    
    .card-header {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .card-body {
        padding: 0.6rem;
    }
    
    .table {
        font-size: 0.75rem;
    }
    
    .btn {
        min-height: 32px;
        padding: 0.3rem 0.45rem;
        font-size: 0.7rem;
        line-height: 1.3;
    }
    
    .btn i {
        font-size: 0.85em;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Áreas de toque adequadas para mobile (mínimo 44x44px recomendado pela Apple/Google) */
    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 0.5rem 1rem;
        touch-action: manipulation; /* Previne double-tap zoom */
    }
    
    .btn-sm {
        min-height: 38px;
        min-width: 38px;
        padding: 0.4rem 0.75rem;
        touch-action: manipulation;
    }
    
    .nav-link,
    .dropdown-item {
        min-height: 44px;
        padding: 0.75rem 1rem;
        touch-action: manipulation;
    }
    
    /* Remover hover effects em touch devices */
    .btn:hover {
        transform: none;
    }
    
    /* Melhorar feedback visual em toque */
    .btn:active {
        opacity: 0.7;
        transform: scale(0.96);
        transition: all 0.1s ease;
    }
    
    .nav-link:active,
    .dropdown-item:active {
        opacity: 0.7;
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    /* Melhorar scroll em mobile */
    * {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
}

/* Word break para textos longos */
.word-break {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Badge pequeno para mobile */
.badge-sm {
    font-size: 12px;
    padding: 0.2rem 0.4rem;
}

/* Badges maiores e mais visíveis */
.badge {
    font-size: 0.875rem;
    padding: 0.4rem 0.6rem;
    font-weight: 500;
    display: inline-block;
    min-width: 50px;
    text-align: center;
}

.badge.fw-bold {
    font-weight: 700 !important;
}

@media (max-width: 768px) {
    .badge-sm {
        font-size: 12px;
        padding: 0.15rem 0.3rem;
    }
    
    .badge {
        font-size: 0.8rem;
        padding: 0.35rem 0.5rem;
        min-width: 45px;
    }
    
    .badge.fs-6 {
        font-size: 0.85rem !important;
        padding: 0.4rem 0.6rem !important;
    }
}

/* Melhorias para TinyMCE */
.tox-tinymce {
    border-radius: 0.25rem;
    width: auto !important;
    min-width: 100% !important;
    max-width: 100% !important;
    border: 2px solid #6c757d !important;
    box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.25) !important;
}

.tox-tinymce:focus-within {
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

.tox .tox-edit-area {
    width: auto !important;
    min-width: 100% !important;
    max-width: 100% !important;
    overflow-y: auto !important;
    overflow-x: auto !important;
}

.tox .tox-edit-area__iframe {
    min-height: 100px;
    width: auto !important;
    min-width: 100% !important;
    max-width: 100% !important;
}

.tox .tox-edit-area iframe {
    width: auto !important;
    min-width: 100% !important;
    max-width: 100% !important;
    overflow-y: auto !important;
    overflow-x: auto !important;
}

/* Garantir que o body do TinyMCE se ajuste dinamicamente ao conteúdo */
.tox .tox-edit-area iframe body {
    padding: 8px !important;
    padding-bottom: 2px !important;
    margin: 0 !important;
    margin-bottom: 0 !important;
    min-height: auto !important;
    width: auto !important;
    min-width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
    box-sizing: border-box !important;
}

.tox .tox-edit-area iframe {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    overflow: hidden !important;
}

.tox .tox-edit-area {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.tox-tinymce {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Remover logo do fabricante do TinyMCE */
.tox .tox-statusbar__branding,
.tox .tox-statusbar__branding a,
.tox-statusbar__branding,
.tox-statusbar__branding a {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
}

/* Remover espaços extras do container do editor */
#knowledge-form {
    margin-bottom: 0 !important;
}

#knowledge-form textarea,
#knowledge-form .tox-tinymce {
    margin-bottom: 0 !important;
}

.tox .tox-toolbar,
.tox .tox-toolbar__overflow {
    flex-wrap: wrap;
}

/* Editor adaptável em mobile */
@media (max-width: 768px) {
    .tox-tinymce {
        border-radius: 0.25rem;
    }
    
    .tox .tox-toolbar,
    .tox .tox-toolbar__overflow {
        flex-wrap: wrap;
    }
}

/* Textarea antes da inicialização do TinyMCE */
textarea#knowledge {
    min-height: 100px;
    font-size: 14px;
    line-height: 1.6;
    width: auto !important;
    min-width: 100% !important;
    max-width: 100% !important;
    overflow-y: auto !important;
    overflow-x: auto !important;
    resize: both !important; /* Permitir redimensionamento tanto vertical quanto horizontal */
    border: 2px solid #6c757d !important;
    border-radius: 0.25rem;
    padding: 0.5rem 0.75rem !important;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    margin-bottom: 0 !important;
    box-sizing: border-box !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
}

textarea#knowledge:focus {
    border-color: #0d6efd !important;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

textarea#knowledge:read-only {
    background-color: #e9ecef;
    border-color: #6c757d !important;
    cursor: not-allowed;
}

@media (min-width: 769px) {
    textarea#knowledge {
        font-size: 11pt;
    }
}

@media (max-width: 768px) {
    textarea#knowledge {
        font-size: 14px;
    }
}

/* DataTables - Ajustes para layout responsivo */
.dataTables_wrapper {
    padding: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    height: auto;
    min-height: auto;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
}

/* Rodapé: alinhar seletor de linhas horizontalmente com a paginação */
.dataTables_wrapper .dataTables_length {
    margin-bottom: 0;              /* não empurrar para baixo no rodapé */
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    box-sizing: border-box;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    font-size: 14px;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow-x: hidden;
    overflow-y: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    max-width: 100%;
    box-sizing: border-box;
}

/* Texto "Pesquisar" (filtro do DataTables) em modo escuro */
html.dark-mode .dataTables_wrapper .dataTables_filter label,
body.dark-mode .dataTables_wrapper .dataTables_filter label {
    color: var(--body-text) !important;
}

.dataTables_wrapper .dataTables_filter input {
    font-size: 14px;
    padding: 0.25rem 0.5rem;
    min-height: 34px;
    max-width: 100%;
    box-sizing: border-box;
}

/* Seletor de linhas com a mesma altura visual dos botões de paginação */
.dataTables_wrapper .dataTables_length select {
    font-size: 14px;
    height: 34px;
    padding: 0.25rem 0.6rem;
    line-height: 1.2;
    min-width: 80px;
    max-width: 150px;
    width: auto;
    /* Remover seta padrão do select (deixar só o retângulo) */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: none !important;
    overflow-x: hidden;
    overflow-y: hidden;
    box-sizing: border-box;
    flex-shrink: 1;
    margin-left: 0.5rem;
}

/* Botões de paginação: mesmo tamanho e alinhamento vertical com o seletor de linhas */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    font-size: 14px;
    height: 34px;
    padding: 0.25rem 0.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Modo escuro: manter mesmo padrão visual do modo claro para filtro e seletor de linhas */
html.dark-mode .dataTables_wrapper .dataTables_filter input,
html.dark-mode .dataTables_wrapper .dataTables_length select,
body.dark-mode .dataTables_wrapper .dataTables_filter input,
body.dark-mode .dataTables_wrapper .dataTables_length select {
    background-color: #111827 !important;
    color: #e5e5ea !important;
    border-color: #374151 !important;
}

/* Container flex que agrupa seletor de linhas + paginação (ajuste responsivo) */
.dataTables_wrapper .d-flex.justify-content-end.align-items-center.gap-2 {
    flex-wrap: wrap;
    column-gap: 0.5rem;
    row-gap: 0.25rem;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .dataTables_wrapper .d-flex.justify-content-end.align-items-center.gap-2 {
        justify-content: center; /* em telas menores, centraliza e permite quebra automática */
        flex-wrap: wrap;
    }
    
    .dataTables_wrapper .d-flex.justify-content-end.align-items-center.gap-2 .dataTables_length {
        flex: 0 0 auto;
        width: auto;
        max-width: 100%;
    }
    
    .dataTables_wrapper .d-flex.justify-content-end.align-items-center.gap-2 .dataTables_paginate {
        flex: 0 0 auto;
        width: auto;
        max-width: 100%;
    }
}

.dataTables_wrapper .dataTables_info {
    font-size: 14px;
    padding-top: 0.75rem;
    margin-top: 0.25rem; /* menos espaço acima da linha \"Mostrando ...\" para aproximar da tabela */
    padding-left: 1.25rem; /* desloca o texto \"Mostrando ...\" para dentro do card */
}

.dataTables_wrapper .dataTables_paginate {
    padding-top: 0.75rem;
    margin-top: 0; /* alinhado com o seletor de linhas na mesma linha */
}

/* Paginação DataTables em modo escuro */
html.dark-mode .dataTables_wrapper .dataTables_info,
body.dark-mode .dataTables_wrapper .dataTables_info {
    color: var(--body-text); /* texto claro no modo escuro */
}

html.dark-mode .dataTables_wrapper .dataTables_paginate,
body.dark-mode .dataTables_wrapper .dataTables_paginate {
    color: var(--body-text); /* textos e ícones em branco/quase branco */
}

html.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button,
body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button {
    background-color: transparent !important;
    border: 1px solid #374151 !important;
    color: var(--body-text) !important;
    margin: 0 2px;
    border-radius: 0.35rem;
}

/* Labels do seletor de linhas também brancos no modo escuro */
html.dark-mode .dataTables_wrapper .dataTables_length label,
body.dark-mode .dataTables_wrapper .dataTables_length label {
    color: var(--body-text) !important;
}

/* Ajustes adicionais para o campo de limite de resultados */
.dataTables_wrapper .dataTables_length label {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin-right: 0.5rem;
}

.dataTables_wrapper .dataTables_length label select {
    margin-left: 0;
}

/* Garantir que o select não ultrapasse os limites */
.dataTables_wrapper .dataTables_length select option {
    max-width: 100%;
    overflow-x: hidden;
    text-overflow: ellipsis;
}

html.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button.current,
html.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover,
html.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button.current,
html.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover,
body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button.current,
body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background-color: #2563eb !important;
    border-color: #2563eb !important;
    color: #f9fafb !important;
}

body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background-color: #111827 !important;
    border-color: #4b5563 !important;
    color: #e5e7eb !important;
}

html.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
html.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,
body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background-color: transparent !important;
    border-color: #374151 !important;
    color: #6b7280 !important;
    cursor: default;
}

/* Paginação Bootstrap (Anterior / Próximo) em modo escuro - aplicado também no html */
html.dark-mode .pagination .page-link,
body.dark-mode .pagination .page-link {
    background-color: #111827;
    border-color: #374151;
    color: var(--body-text);
}

html.dark-mode .pagination .page-link:hover,
body.dark-mode .pagination .page-link:hover {
    background-color: #1f2937;
    border-color: #4b5563;
    color: #f9fafb;
}

html.dark-mode .pagination .page-item.active .page-link,
html.dark-mode .pagination .page-item.active .page-link:hover,
body.dark-mode .pagination .page-item.active .page-link,
body.dark-mode .pagination .page-item.active .page-link:hover {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #f9fafb;
}

html.dark-mode .pagination .page-item.disabled .page-link,
body.dark-mode .pagination .page-item.disabled .page-link {
    background-color: #030712;
    border-color: #111827;
    color: #4b5563;
}


/* -------- Ajustes específicos de permissões de usuário (manage_users) -------- */

/* Headers claros dentro de modais/telas de permissão em modo escuro - aplicado também no html */
html.dark-mode .card-header.bg-light,
body.dark-mode .card-header.bg-light {
    background-color: #020617 !important;
    border-bottom-color: #1f2933 !important;
    color: var(--body-text) !important;
}

/* Caixas internas de cliente (permissões por cliente) em modo escuro - aplicado também no html */
html.dark-mode .knowledge-client-entry,
html.dark-mode .device-client-entry,
body.dark-mode .knowledge-client-entry,
body.dark-mode .device-client-entry {
    background-color: #020617 !important;
    border-color: #1f2933 !important;
}

body.dark-mode .knowledge-client-entry .text-muted,
body.dark-mode .device-client-entry .text-muted {
    color: #9ca3af !important;
}

/* Labels de checkbox visíveis em modo escuro */
body.dark-mode .form-check-label {
    color: var(--body-text) !important;
}

/* Labels e textos da seção "Criar Novo Usuário" em modo escuro */
body.dark-mode .card .form-label,
body.dark-mode #createUserForm .form-label {
    color: var(--body-text) !important;
}

body.dark-mode #createUserForm .form-control {
    color: var(--body-text) !important;
    background-color: #111827;
    border-color: #374151;
}

body.dark-mode #createUserForm .form-control::placeholder {
    color: #9ca3af;
}

/* DataTables Responsive */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.child,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.child,
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dataTables_empty {
    padding: 0.5rem;
}

table.dataTable.dtr-inline.collapsed > tbody > tr > td.child ul,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.child ul {
    font-size: 14px;
}

/* Garantir que células de tabela sejam visíveis em mobile */
@media (max-width: 768px) {
    table.dataTable tbody td {
        white-space: normal !important;
        word-wrap: break-word !important;
        max-width: 100% !important;
        display: table-cell !important;
    }
    
    table.dataTable tbody td strong {
        display: inline-block;
        max-width: 100%;
        word-break: break-word;
    }
    
    /* Garantir que links em células sejam visíveis */
    table.dataTable tbody td a {
        display: inline-block;
        max-width: 100%;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    
    /* Ajustar DataTables responsive para mostrar conteúdo */
    table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child:before {
        top: 0.5rem;
        left: 0.5rem;
    }
    
    /* Garantir que colunas prioritárias sejam sempre visíveis */
    table.dataTable tbody td[data-priority="1"] {
        display: table-cell !important;
        visibility: visible !important;
    }
}

/* Mobile view para DataTables */
@media (max-width: 768px) {
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: left;
        margin-bottom: 0.75rem;
    }
    
    .dataTables_wrapper .dataTables_length {
        flex-wrap: wrap;
        width: 100%;
        max-width: 100%;
    }
    
    .dataTables_wrapper .dataTables_length label {
        font-size: 12px;
        margin-bottom: 0.25rem;
        width: 100%;
        max-width: 100%;
    }
    
    .dataTables_wrapper .dataTables_length select {
        width: auto;
        min-width: 100px;
        max-width: 120px;
        margin-top: 0.25rem;
        margin-left: 0;
        font-size: 13px;
    }
    
    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
        max-width: 100%;
        margin-top: 0.25rem;
        box-sizing: border-box;
    }
    
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        text-align: center;
        margin-top: 0.5rem;
    }
    
    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 0.2rem 0.4rem;
        font-size: 13px;
    }
    
    /* Ajustar tabelas responsivas */
    table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child:before,
    table.dataTable.dtr-inline.collapsed > tbody > tr > th:first-child:before {
        top: 0.5rem;
        left: 0.5rem;
    }
}

/* Modo Fullscreen (Página Inteira) */
body.fullscreen-active {
    overflow: hidden;
}

/* Garantir que o sidebar funcione mesmo quando fullscreen-active está presente (mas não em modo fullscreen) */
body.fullscreen-active .sidebar.show {
    z-index: 1001 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    display: block !important;
}

/* Linha de estatísticas - manter todos na mesma linha horizontal com ajuste dinâmico */
.row.mb-4 {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    overflow-x: hidden;
    overflow-y: hidden;
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    box-sizing: border-box;
}

/* Cards de estatísticas (indicativos) - ajuste dinâmico e autoajustável */
.row.mb-4 > .col-xl-3,
.row.mb-4 > .col-md-6,
.row.mb-4 > .col-lg-4,
.row.mb-4 > .col-sm-12 {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
}

/* Cards de estatísticas com h-100 */
.card.h-100 {
    height: 100%;
    min-height: auto;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: visible;
    display: flex;
    flex-direction: column;
}

/* Cards com border-left (estatísticas) */
.card.border-left-primary,
.card.border-left-success,
.card.border-left-info,
.card.border-left-warning {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    box-sizing: border-box;
}

/* Padding dos cards de estatísticas */
.card.py-2 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    box-sizing: border-box;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Linhas no-gutters dentro dos cards de estatísticas */
.card .row.no-gutters {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    display: flex;
    align-items: center;
    flex: 1;
    box-sizing: border-box;
}

.card .row.no-gutters > * {
    padding-left: 0;
    padding-right: 0;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    box-sizing: border-box;
}

/* Colunas dentro dos cards de estatísticas */
.card .col,
.card .col.mr-2 {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    padding-right: 0.5rem;
    box-sizing: border-box;
}

/* Ícones dentro dos cards de estatísticas */
.card .col-auto {
    flex: 0 0 auto;
    width: auto;
    min-width: 40px;
    max-width: 60px;
    overflow-x: hidden;
    overflow-y: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.card .col-auto i {
    max-width: 100%;
    font-size: clamp(1.25rem, 2.5vw, 2rem);
    display: block;
    overflow-x: hidden;
    overflow-y: hidden;
}

/* Textos dentro dos cards de estatísticas */
.card .text-xs,
.card .h5 {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
}

/* Números grandes nos cards de estatísticas */
.card .h5.mb-0 {
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    line-height: 1.2;
    overflow-x: hidden;
    overflow-y: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Labels dos cards de estatísticas */
.card .text-xs.font-weight-bold {
    font-size: clamp(0.6rem, 1.5vw, 0.75rem);
    line-height: 1.3;
    overflow-x: hidden;
    overflow-y: hidden;
    white-space: normal;
    word-break: break-word;
    min-width: 0;
}

/* Responsividade para cards de estatísticas - manter na mesma linha até o limite */
@media (max-width: 992px) {
    .row.mb-4 {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .row.mb-4 > .col-xl-3,
    .row.mb-4 > .col-md-6 {
        flex: 1 1 calc(50% - 0.375rem);
        min-width: 200px;
    }
}

@media (max-width: 576px) {
    .row.mb-4 {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .row.mb-4 > .col-xl-3,
    .row.mb-4 > .col-md-6 {
        flex: 1 1 100%;
        min-width: 100%;
    }
    
    .card .col-auto i {
        font-size: 1.5rem;
    }
}

.fullscreen-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    /* Ficar acima do botão de expansão da sidebar (que usa z-index 10001) */
    z-index: 10002 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.fullscreen-mode .card-header {
    position: relative !important;
}

.fullscreen-mode .card-body {
    height: calc(100vh - 60px) !important;
    overflow: auto !important;
    padding: 1rem !important;
}

.fullscreen-mode .tox-tinymce {
    width: 100% !important;
    max-width: 100% !important;
    height: calc(100vh - 150px) !important;
    min-height: calc(100vh - 150px) !important;
}

.fullscreen-mode .tox .tox-edit-area iframe {
    height: calc(100vh - 180px) !important;
    min-height: calc(100vh - 180px) !important;
}

.fullscreen-mode textarea#knowledge {
    width: 100% !important;
    height: calc(100vh - 150px) !important;
    min-height: calc(100vh - 150px) !important;
}

/* Ajustar editor no modo fullscreen para aproveitar todo espaço */
.fullscreen-mode .alert {
    margin-bottom: 0.5rem !important;
}


/* ============================================
   OTIMIZAÇÕES AVANÇADAS PARA MOBILE
   ============================================ */

@media (max-width: 768px) {
    /* Melhorias de Touch Targets */
    /* Garantir que todos os elementos clicáveis tenham pelo menos 44x44px */
    a, button, input[type="button"], input[type="submit"], 
    input[type="checkbox"], input[type="radio"], select, 
    .nav-link, .dropdown-item, .pagination .page-link {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
    
    /* Inputs e selects otimizados para mobile */
    .form-control, .form-select, input[type="text"], 
    input[type="password"], input[type="email"], 
    input[type="number"], input[type="search"], 
    input[type="tel"], input[type="url"], textarea, select {
        font-size: 16px !important; /* Previne zoom automático no iOS */
        min-height: 44px;
        padding: 0.5rem 0.75rem;
        border-radius: 8px;
        -webkit-appearance: none;
        appearance: none;
    }
    
    /* Labels mais espaçados */
    .form-label {
        font-size: 14px;
        font-weight: 500;
        margin-bottom: 0.5rem;
        display: block;
    }
    
    /* Checkboxes e radios maiores */
    .form-check-input {
        width: 20px;
        height: 20px;
        min-width: 20px;
        min-height: 20px;
        margin-top: 0.25rem;
    }
    
    .form-check-label {
        padding-left: 0.5rem;
        font-size: 14px;
        line-height: 1.5;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Modais otimizados para mobile */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 12px;
        max-height: calc(100vh - 1rem);
        display: flex;
        flex-direction: column;
    }
    
    .modal-header {
        padding: 1rem;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        flex-shrink: 0;
    }
    
    .modal-title {
        font-size: 1.1rem;
        font-weight: 600;
    }
    
    .modal-body {
        padding: 1rem;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: 1 1 auto;
    }
    
    .modal-footer {
        padding: 0.75rem 1rem;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        flex-shrink: 0;
        display: flex;
        gap: 0.5rem;
        justify-content: flex-end;
    }
    
    /* Dropdowns otimizados */
    .dropdown-menu {
        max-width: calc(100vw - 2rem);
        max-height: 50vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    .dropdown-item {
        padding: 0.75rem 1rem;
        font-size: 14px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Tabelas com melhor scroll horizontal */
    .table-responsive:not(.has-card-view) {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        border-radius: 8px;
        margin: 0 -0.75rem;
        padding: 0 0.75rem;
    }
    
    .table-responsive:not(.has-card-view) table {
        min-width: 600px;
    }
    
    /* Em telas muito pequenas, ajustar margens se não tiver card view */
    @media (max-width: 576px) {
        .table-responsive:not(.has-card-view) {
            margin: 0;
            padding: 0;
        }
        
        .table-responsive.has-card-view {
            margin: 0;
            padding: 0;
        }
    }
    
    /* Cards com melhor espaçamento */
    .card {
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        margin-bottom: 1rem;
    }
    
    .card-header {
        padding: 1rem;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        font-weight: 600;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Navegação mobile melhorada */
    .navbar-nav {
        flex-direction: row;
        align-items: center;
    }
    
    .navbar-nav .nav-link {
        padding: 0.5rem 0.75rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Sidebar com melhor touch */
    .sidebar .nav-link {
        min-height: 48px;
        padding: 0.75rem 1rem;
        display: flex;
        align-items: center;
        border-radius: 8px;
        margin: 0.25rem 0.5rem;
    }
    
    .sidebar .nav-link i {
        min-width: 24px;
        text-align: center;
    }
    
    /* Topbar otimizada */
    .topbar {
        padding: 0.5rem 0.75rem;
        min-height: 56px;
    }
    
    /* Paginação mobile-friendly */
    .pagination {
        flex-wrap: wrap;
        gap: 0.25rem;
        justify-content: center;
    }
    
    .pagination .page-link {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        font-size: 14px;
    }
    
    /* Alerts mais visíveis */
    .alert {
        padding: 1rem;
        border-radius: 8px;
        font-size: 14px;
        margin-bottom: 1rem;
    }
    
    /* Badges maiores */
    .badge {
        padding: 0.4rem 0.6rem;
        font-size: 12px;
        border-radius: 6px;
    }
    
    /* Espaçamentos otimizados */
    .mb-4 {
        margin-bottom: 1rem !important;
    }
    
    .mb-3 {
        margin-bottom: 0.75rem !important;
    }
    
    .mt-4 {
        margin-top: 1rem !important;
    }
    
    .mt-3 {
        margin-top: 0.75rem !important;
    }
    
    /* Headings responsivos */
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    h4, h5, h6 {
        font-size: 1rem;
    }
    
    /* Melhorias de scroll */
    * {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Prevenir seleção acidental */
    .btn, .nav-link, .dropdown-item {
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* Melhor feedback visual em toque */
    .btn:active, .nav-link:active, .dropdown-item:active {
        opacity: 0.7;
        transform: scale(0.98);
    }
    
    /* DataTables mobile */
    .dataTables_wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_length {
        margin-bottom: 0.75rem;
    }
    
    .dataTables_wrapper .dataTables_filter input {
        min-height: 44px;
        font-size: 16px;
    }
    
    .dataTables_wrapper .dataTables_length select {
        min-height: 44px;
        font-size: 16px;
    }
    
    /* Grupos de botões */
    .btn-group, .btn-group-vertical {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .btn-group .btn,
    .btn-group-vertical .btn {
        flex: 1 1 auto;
        min-width: 44px;
    }
    
    /* Input groups */
    .input-group {
        flex-wrap: wrap;
    }
    
    .input-group .form-control,
    .input-group .form-select {
        min-height: 44px;
    }
    
    .input-group-text {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* List groups */
    .list-group-item {
        padding: 0.75rem 1rem;
        min-height: 44px;
        font-size: 14px;
    }
    
    /* Breadcrumbs */
    .breadcrumb {
        font-size: 13px;
        padding: 0.5rem 0.75rem;
    }
    
    .breadcrumb-item {
        min-height: 32px;
        display: flex;
        align-items: center;
    }
    
    /* Tooltips e popovers */
    .tooltip, .popover {
        font-size: 13px;
    }
    
    /* Scroll to top button maior */
    .scroll-to-top {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        right: 1rem;
        bottom: 1rem;
        border-radius: 50%;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
    
    .scroll-to-top i {
        font-size: 1.3rem;
    }
}

/* Telas muito pequenas (menos de 360px) */
@media (max-width: 360px) {
    html {
        font-size: 13px;
    }
    
    .card-header {
        padding: 0.75rem;
        font-size: 13px;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .btn {
        font-size: 13px;
        padding: 0.4rem 0.6rem;
    }
    
    .modal-dialog {
        margin: 0.25rem;
    }
    
    .modal-content {
        max-height: calc(100vh - 0.5rem);
    }
}

/* Orientação landscape em mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .modal-dialog {
        max-height: 90vh;
    }
    
    .modal-body {
        max-height: calc(90vh - 120px);
    }
    
    .sidebar {
        width: 240px;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .topbar,
    .scroll-to-top,
    .btn,
    .sidebar-overlay {
        display: none !important;
    }
    
    #content-wrapper {
        margin-left: 0 !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
