:root {
    --bg-main: #FFFFFF; 
    --bg-card: #FFFFFF;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #9CA3AF;
    --border-color: #e2e8f0;
    
    /* Esquema de Cores Intranet TTW */
    --primary-color: #165673; /* Azul Escuro */
    --primary-hover: #114259;
    --secondary-color: #B89768; /* Dourado claro */
    --secondary-hover: #9e825a;
    
    --brand-color: #1d6b8c; /* Azul SmartLink */
    --brand-hover: #165673;
    --danger-color: #d9534f;
    --danger-hover: #c9302c;
    --success-color: #16a34a;
    
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-float: 0 2px 5px rgba(0, 0, 0, 0.05);
    --shadow-float-hover: 0 4px 10px rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-main);
    /* Fundo dinâmico suave para efeito flutuante */
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,0.03) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,0.03) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,0.03) 0, transparent 50%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

/* Layout do Dashboard */
.dashboard-wrapper {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    padding: 0;
    gap: 0;
}

@media (min-width: 1024px) {
    .dashboard-wrapper {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    padding: 0;
    gap: 0;
}
}

/* Estilos do Cabeçalho Corporativo */
.corporate-header-wrapper {
    width: 100%;
    background-color: #fff;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 1rem;
}

.micro-top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 10px 2rem;
    font-size: 0.95rem;
    color: #444;
}

.separator-dots {
    border-left: 1px dotted #999;
    height: 16px;
    margin: 0 15px;
}

.btn-text-blue {
    background: none;
    border: none;
    color: #2b5f8c;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: inherit;
}
.btn-text-blue:hover {
    text-decoration: underline;
}

.main-corporate-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 2rem;
}

.logo-area {
    font-size: 1.8rem;
    display: flex;
    align-items: baseline;
}
.logo-ttw { font-weight: 700; color: var(--primary-color); }
.logo-group { font-weight: 300; color: #666; }
.logo-divider { color: var(--secondary-color); margin: 0 10px; font-weight: 300; }
.logo-system { color: #999; font-weight: 300; }

.nav-links {
    display: flex;
    gap: 12px;
    align-items: center;
}
.nav-links a.btn-nav {
    text-decoration: none;
    color: var(--brand-color);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 18px;
    border: 1.5px solid var(--brand-color);
    border-radius: 10px;
    transition: all 0.25s ease;
    background: transparent;
}
.nav-links a.btn-nav:hover {
    background: var(--brand-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

@media (min-width: 1024px) {
    .main-content {
        flex: 1;
        overflow-y: auto;
        padding: 0 2rem; /* preenchimento lateral */
    }
}

.main-content::-webkit-scrollbar {
    width: 6px;
}
.main-content::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.logo-area h2 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-icon {
    color: var(--primary-color);
}



/* Elementos Flutuantes do Conteúdo Principal */
.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}

@media (min-width: 1280px) {
    .content-grid {
        grid-template-columns: 380px 1fr;
    }
}

/* Cartões Flutuantes */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); /* Sombra plana, suave e formal */
    padding: 1.75rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    border-color: rgba(75, 83, 32, 0.3); /* Tom sutil de verde ao passar o mouse */
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* Formulários */
.form-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #D1D5DB;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.8);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: all 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    background: #FFFFFF;
}

.form-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
    width: 100%;
}
.row-actions { 
    display: flex;
    gap: 1rem; 
    flex-wrap: nowrap; /* Garante que fiquem lado a lado por padrão */
}
@media (max-width: 480px) {
    .row-actions { flex-wrap: wrap; }
    .row-actions .btn { width: 100%; flex: none; }
}
.row-actions .btn {
    flex: 1;
    min-width: 100px; /* Reduzi um pouco para caber 3 botões em colunas */
    text-align: center;
}

/* Botões */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--brand-color);
    color: white;
    width: 100%;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background-color: var(--brand-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-secondary);
    border-color: #D1D5DB;
}
.btn-secondary:hover {
    background: #F3F4F6;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 8px;
    box-shadow: none;
}

.btn-edit-outline {
    background: white;
    color: var(--brand-color);
    border: 1px solid var(--brand-color);
    margin-right: 0.5rem;
}
.btn-edit-outline:hover {
    background: #EFF6FF;
    transform: none;
    box-shadow: none;
}

/* Tabela */
.table-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}
.table-header .card-title { margin-bottom: 0; }

.search-wrap input {
    width: 260px;
    border-radius: 999px;
    padding: 0.6rem 1.25rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.data-table th, .data-table td {
    padding: 1.25rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s, color 0.2s;
    position: relative;
    white-space: nowrap;
}

.data-table th:hover {
    background-color: #f8fafc;
    color: var(--primary-color);
}

.data-table th.active-sort {
    color: var(--primary-color);
}

.sort-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 5px;
    vertical-align: middle;
    opacity: 0.3;
    transition: opacity 0.2s, transform 0.2s;
}

.data-table th:hover .sort-indicator {
    opacity: 0.6;
}

.active-sort .sort-indicator {
    opacity: 1;
}

.sort-asc .sort-indicator {
    transform: rotate(0deg);
}

.sort-desc .sort-indicator {
    transform: rotate(180deg);
}


.data-table tbody tr {
    transition: background-color 0.2s;
}
.data-table tbody tr:hover {
    background-color: rgba(243, 244, 246, 0.6);
}

.type-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: #EFF6FF;
    color: #1D4ED8;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}
.tag-text {
    font-family: monospace;
    font-weight: 600;
    color: var(--text-secondary);
    background: #F3F4F6;
    padding: 3px 8px;
    border-radius: 6px;
}

/* Modais e Sobreposições */
.modal, .login-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(17, 24, 39, 0.5); /* Sobreposição escura */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    justify-content: center;
    align-items: flex-start; /* Alinhamento ao topo para permitir rolagem natural */
    overflow-y: auto; /* Habilita o scroll vertical no fundo do modal */
    padding: 2rem 0; /* Espaço para o modal não colar nas bordas */
    animation: fadeIn 0.3s ease-out;
}
.modal.show, .login-overlay.show { display: flex; }

.modal-content, .login-card {
    background: #FFFFFF;
    width: 90%;
    margin: auto; /* Centraliza horizontal e verticalmente (se houver espaço) */
    max-width: 440px;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e5e5;
}

.modal-content.history-layout {
    max-width: 950px;
    width: 95%; /* Ocupa quase toda a largura em telas menores */
    display: flex;
    flex-direction: column;
    height: 90vh; /* Um pouco mais alto para aproveitar telas */
    padding: 0;
    overflow: hidden; /* Evita que o modal inteiro tenha scroll */
    background: white;
}
@media (min-width: 1024px) {
    .modal-content.history-layout { flex-direction: row; }
}

.history-left {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    overflow-y: auto;
    overflow-x: hidden; /* Corta o scroll horizontal indesejado */
}
.history-right {
    flex: 1;
    background: #F9FAFB;
    padding: 2rem;
    border-left: 1px solid #E5E7EB;
    overflow-y: auto;
}

/* Linha do Tempo */
.timeline {
    position: relative;
    padding-left: 1.25rem;
    margin-top: 1.5rem;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 2px;
    background: #D1D5DB;
}
.time-item {
    position: relative;
    padding-left: 1.5rem;
    padding-bottom: 2rem;
}
.time-item::before {
    content: '';
    position: absolute;
    left: -0.45rem; top: 0.15rem;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary-color);
}
.time-date {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-bottom: 0.25rem;
}
.time-event {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}
.time-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.4rem;
    line-height: 1.5;
}
.login-error { 
    color: var(--danger-color); 
    text-align: center; 
    font-size: 0.9rem;
    font-weight: 500;
    padding: 10px;
    background-color: rgba(217, 83, 79, 0.05);
    border-radius: 4px;
    border: 1px solid rgba(217, 83, 79, 0.2);
}

/* ESTILOS DE NOTIFICAÇÃO TOAST */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    background: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 1rem;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-left: 4px solid var(--text-tertiary);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.loading { border-left-color: var(--brand-color); }
.toast.success { border-left-color: var(--success-color); }
.toast.error { border-left-color: var(--danger-color); }

.toast-icon {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-msg {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
}

/* CSS do Ícone de Carregamento */
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(59, 130, 246, 0.2);
    border-radius: 50%;
    border-top-color: var(--brand-color);
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Badges para Gerenciamento de Usuários */
.user-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}
.status-ativo { background: #dcfce7; color: #166534; }
.status-inativo { background: #fee2e2; color: #991b1b; }

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #f3f4f6;
    color: #4b5563;
}
.role-super { background: #fef3c7; color: #92400e; }
.role-admin { background: #e0f2fe; color: #075985; }
.role-viewer { background: #f1f5f9; color: #475569; }

/* =============================================
   BOTÕES DE AÇÃO — TABELA DE USUÁRIOS
   ============================================= */
.user-actions-cell {
    display: flex;
    flex-direction: row;
    gap: 6px;
    align-items: center;
}

.btn-ua {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 30px;
    font-size: 0.73rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    background: transparent;
}

.btn-ua-reset {
    color: #4A5D23;
    border: 1px solid #4A5D23;
}
.btn-ua-reset:hover {
    background: #4A5D23;
    color: #fff;
}

.btn-ua-toggle {
    color: #64748b;
    border: 1px solid #94a3b8;
}
.btn-ua-toggle:hover {
    background: #64748b;
    color: #fff;
}

.btn-ua-delete {
    color: #dc2626;
    border: 1px solid #dc2626;
}
.btn-ua-delete:hover {
    background: #dc2626;
    color: #fff;
}

/* Modal de Usuários — layout limpo e integrado */
#janela-cadastro-usuarios .modal-content {
    max-width: 800px; /* Um pouco mais largo para acomodar a tabela e o formulário */
    width: 95%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#janela-cadastro-usuarios .data-table {
    width: 100%;
    border-collapse: collapse;
}

#janela-cadastro-usuarios .table-responsive {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
}

#janela-cadastro-usuarios .data-table th,
#janela-cadastro-usuarios .data-table td {
    padding: 12px;
    vertical-align: middle;
}

#janela-cadastro-usuarios .card-title {
    margin-bottom: 5px;
}

#divisor-criacao-usuarios {
    margin: 25px 0 !important;
}

/* =============================================
   BOTÃO VOLTAR AO TOPO
   ============================================= */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: var(--primary-hover);
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.back-to-top svg {
    width: 28px;
    height: 28px;
}

/* Ajustes para telas menores */
@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 42px;
        height: 42px;
    }
}



/* =============================================
   NOVO LAYOUT LATERAL E VIEWS
   ============================================= */

/* Sidebar Fixa */
.sidebar {
    width: 280px;
    background-color: #ffffff; /* Tema Claro Corporativo */
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    transition: width 0.3s;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    overflow-x: hidden;
    white-space: nowrap;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    height: 28px;
    border-radius: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    margin-right: 15px;
    opacity: 0.7;
}

.nav-item:hover {
    background-color: #f8fafc;
    color: var(--primary-color);
}

.nav-item.active {
    background-color: #f1f5f9;
    color: var(--primary-color);
    border-left-color: var(--brand-color);
}

.nav-item.active svg {
    opacity: 1;
    color: var(--brand-color);
}

.sidebar-footer {
    padding: 10px 0;
    border-top: 1px solid var(--border-color);
}

.btn-logout {
    display: flex;
    align-items: center;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-logout svg {
    width: 20px;
    height: 20px;
    margin-right: 15px;
}

.btn-logout:hover {
    color: #ef4444;
}

/* Área de Conteúdo Principal */
.main-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-main);
}

/* Topbar */
.topbar {
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
}

.views-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
    padding: 30px;
}

.app-view {
    display: none;
    animation: fadeIn 0.4s ease;
}

.app-view.active {
    display: block;
}

/* =============================================
   DASHBOARD CARDS E GRÁFICO
   ============================================= */

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 15px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    border-left: 5px solid var(--brand-color);
}

.stat-card h3 {
    font-size: 0.85rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}

.stat-success { border-left-color: #10b981; }
.stat-info { border-left-color: #3b82f6; }
.stat-warning { border-left-color: #f59e0b; }

.dashboard-stats.small-cards {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 15px;
    padding-bottom: 10px;
    scroll-behavior: smooth;
    width: 100%;
}

.dashboard-stats.small-cards::-webkit-scrollbar {
    height: 8px;
}
.dashboard-stats.small-cards::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}
.dashboard-stats.small-cards::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.dashboard-stats.small-cards::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.stat-card.stat-small {
    flex: 0 0 calc(20% - 12px);
    min-width: 140px;
    padding: 12px 10px;
}
.stat-card.stat-small h3 {
    font-size: 0.7rem;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stat-card.stat-small .stat-value {
    font-size: 1.2rem;
}

@media (max-width: 1024px) {
    .stat-card.stat-small {
        flex: 0 0 calc(33.333% - 10px);
        min-width: 120px;
    }
}
@media (max-width: 768px) {
    .stat-card.stat-small {
        flex: 0 0 calc(50% - 8px);
        min-width: 110px;
    }
}

.dashboard-charts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.chart-container {
    background: #fff;
    padding: 20px;
    height: auto;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.chart-container canvas {
    max-height: 350px;
}


/* ==========================================
   MINIMIZAR SIDEBAR DESKTOP
   ========================================== */
.sidebar {
    transition: width 0.3s ease, margin-right 0.3s ease;
    position: relative;
    z-index: 100;
}

.sidebar.hover-expanded {
    margin-right: -200px;
}

.sidebar.minimized {
    width: 80px;
}

.sidebar.minimized .nav-text {
    display: none;
}

.sidebar.minimized .nav-item {
    justify-content: center;
    padding: 15px 0;
}

.sidebar.minimized .nav-item svg {
    margin-right: 0;
}



.sidebar.minimized .sidebar-footer button {
    justify-content: center;
    padding: 15px 0;
}

.sidebar.minimized .toggle-icon {
    margin-right: 0 !important;
    transform: rotate(180deg);
}

.sidebar.hover-expanded .toggle-icon {
    transform: rotate(180deg);
}

.sidebar.minimized .btn-logout svg {
    margin-right: 0;
}
/* =============================================
   RESPONSIVIDADE E DISPOSITIVOS MÓVEIS
   ============================================= */
@media (max-width: 1024px) {
    .dashboard-wrapper { flex-direction: column; padding-bottom: 65px; }
    
    /* SIDEBAR BECOMES BOTTOM NAVBAR */
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 65px;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--border-color);
        background: #fff;
        z-index: 1000;
        padding: 0;
        overflow: hidden;
    }
    
    .sidebar-header, .sidebar-footer { display: none; }
    
    .sidebar-nav {
        display: flex;
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
        align-items: center;
        padding: 0;
        white-space: nowrap;
    }
    
    .nav-item {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 8px 5px;
        font-size: 0.65rem;
        flex: 1;
        text-align: center;
        border-radius: 0;
    }
    
    .nav-item.active {
        background: transparent;
        color: var(--brand-color);
        border-top: 3px solid var(--brand-color);
    }
    
    .nav-item svg {
        margin: 0 0 4px 0;
        width: 22px;
        height: 22px;
    }
    
    /* TOPBAR COMPACTA */
    .topbar {
        flex-direction: row;
        justify-content: space-between;
        padding: 10px 15px;
        position: sticky;
        top: 0;
        background: #fff;
        z-index: 999;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }
    .mobile-logo { display: block !important; height: 26px; }
    .page-title { display: none; }
    .user-info { display: none; }
    .mobile-logout {
        display: flex !important;
        background: none;
        border: none;
        color: var(--danger-color);
        padding: 5px;
        cursor: pointer;
    }
    
    .dashboard-charts { grid-template-columns: 1fr; }
    
    .dashboard-stats {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px;
    }
    .stat-card {
        padding: 12px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    .stat-card h3 { font-size: 0.7rem; }
    .stat-value { font-size: 1.3rem; }
    
    .content-grid, .form-grid { grid-template-columns: 1fr !important; }
    .views-container { padding: 10px; }
    .table-responsive, .table-container { overflow-x: auto; display: block; width: 100%; -webkit-overflow-scrolling: touch; }
    th, td { white-space: nowrap; }
}

@media (max-width: 480px) {
    .dashboard-stats {
        grid-template-columns: 1fr 1fr !important; /* Keep as blocks */
    }
}

/* Profile Dropdown */
.user-profile-trigger:hover {
    background-color: rgba(0,0,0,0.05);
}
.btn-logout-dropdown:hover {
    background-color: #333 !important;
    color: #fff !important;
}

.sidebar-logo-completa {
    height: 28px;
    border-radius: 4px;
}
.sidebar-logo-reduzida {
    display: none;
    height: 28px;
    object-fit: contain;
}

.sidebar.minimized .sidebar-logo-completa {
    display: none;
}
.sidebar.minimized .sidebar-logo-reduzida {
    display: block;
    margin: 0 auto;
}
.sidebar.minimized .sidebar-header {
    padding: 15px 0;
    display: flex;
    justify-content: center;
}

/* ==========================================
   BOTAO FLUTUANTE VOLTAR AO TOPO
   ========================================== */
.btn-floating-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}
.btn-floating-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.btn-floating-top:hover {
    background-color: var(--primary-hover);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

@media (max-width: 1024px) {
    .btn-floating-top {
        bottom: 85px; /* Acima da navbar inferior */
        right: 20px;
        width: 40px;
        height: 40px;
    }
}

/* Botões de Paginação */
.btn-pagination {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background-color: white;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    transition: all 0.2s ease;
    cursor: pointer;
}
.btn-pagination:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.btn-pagination:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f1f5f9;
}

.stat-danger {
    border-left-color: #ef4444;
}



/* Centralizar view de Relatorios */
#view-relatorios.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 100%;
}
#view-relatorios .form-card {
    width: 100%;
    margin: 0 !important;
}
