/* ============================================================================
   D.Y.M. BUSINESS CONSULTING - PREMIUM THEME
   Cores: Azul Escuro (#0a1628, #1a2a4a) + Dourado (#c9a84c, #d4af37)
   ============================================================================ */

/* ── Reset & Base ────────────────────────────────────────────────────────── */
:root {
    --azul-escuro: #0a1628;
    --azul-medio: #1a2a4a;
    --azul-claro: #243656;
    --azul-hover: #2d4a7a;
    --dourado: #c9a84c;
    --dourado-claro: #d4af37;
    --dourado-hover: #e0c068;
    --dourado-bg: rgba(201, 168, 76, 0.1);
    --branco: #ffffff;
    --cinza-claro: #f8f9fa;
    --cinza-medio: #e9ecef;
    --cinza-texto: #6c757d;
    --texto-escuro: #212529;
    --texto-claro: #adb5bd;
    --sucesso: #28a745;
    --perigo: #dc3545;
    --alerta: #ffc107;
    --info: #17a2b8;
    --sombra: 0 2px 15px rgba(0, 0, 0, 0.1);
    --sombra-forte: 0 4px 25px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--cinza-claro);
    color: var(--texto-escuro);
    overflow-x: hidden;
}

/* ── Scrollbar Premium ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--azul-escuro); }
::-webkit-scrollbar-thumb { background: var(--dourado); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--dourado-hover); }

/* ── Layout Principal ────────────────────────────────────────────────────── */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
    width: 280px;
    min-height: 100vh;
    background: linear-gradient(180deg, var(--azul-escuro) 0%, var(--azul-medio) 100%);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.3);
}

.sidebar-header {
    padding: 25px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(201, 168, 76, 0.2);
}

.sidebar-logo {
    max-width: 180px;
    height: auto;
    margin-bottom: 10px;
}

.sidebar-brand {
    color: var(--dourado);
    font-size: 0.85rem;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ── Menu Items ──────────────────────────────────────────────────────────── */
.sidebar-menu {
    padding: 15px 0;
    list-style: none;
}

.menu-item {
    margin: 2px 10px;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
    font-size: 0.9rem;
}

.menu-link:hover {
    background: rgba(201, 168, 76, 0.15);
    color: var(--dourado);
    transform: translateX(5px);
}

.menu-link.active {
    background: rgba(201, 168, 76, 0.2);
    color: var(--dourado);
    border-left: 3px solid var(--dourado);
}

.menu-link i {
    width: 24px;
    margin-right: 12px;
    font-size: 1.1rem;
    text-align: center;
}

.menu-label {
    font-size: 0.75rem;
    color: var(--dourado);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 15px 20px 5px;
    font-weight: 600;
}

/* ── Submenu ─────────────────────────────────────────────────────────────── */
.submenu {
    list-style: none;
    padding-left: 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.submenu.show {
    max-height: 500px;
}

.submenu .menu-link {
    padding: 8px 15px;
    font-size: 0.85rem;
}

.menu-toggle::after {
    content: '\f282';
    font-family: 'bootstrap-icons';
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.3s;
}

.menu-toggle.expanded::after {
    transform: rotate(90deg);
}

/* ── Main Content ────────────────────────────────────────────────────────── */
.main-content {
    margin-left: 280px;
    flex: 1;
    min-height: 100vh;
    transition: var(--transition);
}

/* ── Top Bar ─────────────────────────────────────────────────────────────── */
.topbar {
    background: var(--branco);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--sombra);
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--azul-escuro);
}

.topbar-title span {
    color: var(--dourado);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.topbar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--azul-medio);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dourado);
    font-weight: bold;
    font-size: 1rem;
    border: 2px solid var(--dourado);
}

.topbar-user-info {
    text-align: right;
}

.topbar-user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--azul-escuro);
}

.topbar-user-role {
    font-size: 0.75rem;
    color: var(--cinza-texto);
}

/* ── Page Content ────────────────────────────────────────────────────────── */
.page-content {
    padding: 30px;
}

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

.page-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--azul-escuro);
}

.page-header h1 span {
    color: var(--dourado);
}

.page-subtitle {
    color: var(--cinza-texto);
    font-size: 0.95rem;
    margin-top: 5px;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card-premium {
    background: var(--branco);
    border-radius: var(--border-radius);
    box-shadow: var(--sombra);
    border: none;
    overflow: hidden;
    transition: var(--transition);
}

.card-premium:hover {
    box-shadow: var(--sombra-forte);
    transform: translateY(-2px);
}

.card-premium .card-header {
    background: linear-gradient(135deg, var(--azul-escuro), var(--azul-medio));
    color: var(--branco);
    padding: 15px 20px;
    border: none;
    font-weight: 600;
}

.card-premium .card-header .dourado {
    color: var(--dourado);
}

.card-premium .card-body {
    padding: 25px;
}

/* ── KPI Cards ───────────────────────────────────────────────────────────── */
.kpi-card {
    background: var(--branco);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--sombra);
    border-left: 4px solid var(--dourado);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--sombra-forte);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: var(--dourado-bg);
    border-radius: 0 0 0 80px;
}

.kpi-label {
    font-size: 0.8rem;
    color: var(--cinza-texto);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--azul-escuro);
    line-height: 1.2;
}

.kpi-variation {
    font-size: 0.85rem;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.kpi-variation.positive { color: var(--sucesso); }
.kpi-variation.negative { color: var(--perigo); }

.kpi-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 2rem;
    color: var(--dourado);
    opacity: 0.3;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-premium {
    width: 100%;
    border-collapse: collapse;
}

.table-premium thead th {
    background: linear-gradient(135deg, var(--azul-escuro), var(--azul-medio));
    color: var(--branco);
    padding: 12px 15px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
}

.table-premium thead th:first-child {
    border-radius: 8px 0 0 0;
}

.table-premium thead th:last-child {
    border-radius: 0 8px 0 0;
}

.table-premium tbody td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--cinza-medio);
    font-size: 0.9rem;
}

.table-premium tbody tr:hover {
    background: var(--dourado-bg);
}

.table-premium .valor-positivo { color: var(--sucesso); font-weight: 600; }
.table-premium .valor-negativo { color: var(--perigo); font-weight: 600; }
.table-premium .valor-destaque { color: var(--dourado-claro); font-weight: 700; }

.table-premium .linha-total {
    background: linear-gradient(135deg, var(--azul-escuro), var(--azul-medio));
    color: var(--branco);
    font-weight: 700;
}

.table-premium .linha-total td {
    border: none;
    padding: 14px 15px;
}

.table-premium .linha-subtotal {
    background: var(--cinza-claro);
    font-weight: 600;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-premium {
    background: linear-gradient(135deg, var(--dourado), var(--dourado-claro));
    color: var(--azul-escuro);
    border: none;
    padding: 10px 25px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-premium:hover {
    background: linear-gradient(135deg, var(--dourado-hover), var(--dourado));
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(201, 168, 76, 0.4);
    color: var(--azul-escuro);
}

.btn-outline-premium {
    background: transparent;
    color: var(--dourado);
    border: 2px solid var(--dourado);
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-outline-premium:hover {
    background: var(--dourado);
    color: var(--azul-escuro);
}

.btn-azul {
    background: linear-gradient(135deg, var(--azul-escuro), var(--azul-medio));
    color: var(--branco);
    border: none;
    padding: 10px 25px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-azul:hover {
    background: linear-gradient(135deg, var(--azul-medio), var(--azul-hover));
    color: var(--branco);
}

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-premium .form-control {
    border: 2px solid var(--cinza-medio);
    border-radius: 8px;
    padding: 10px 15px;
    transition: var(--transition);
    font-size: 0.9rem;
}

.form-premium .form-control:focus {
    border-color: var(--dourado);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2);
    outline: none;
}

.form-premium label {
    font-weight: 600;
    color: var(--azul-escuro);
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.form-premium select {
    border: 2px solid var(--cinza-medio);
    border-radius: 8px;
    padding: 10px 15px;
    background: var(--branco);
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge-premium {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-sucesso { background: rgba(40, 167, 69, 0.15); color: var(--sucesso); }
.badge-perigo { background: rgba(220, 53, 69, 0.15); color: var(--perigo); }
.badge-alerta { background: rgba(255, 193, 7, 0.15); color: #856404; }
.badge-info { background: rgba(23, 162, 184, 0.15); color: var(--info); }
.badge-dourado { background: var(--dourado-bg); color: var(--dourado-claro); }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert-premium {
    border-radius: var(--border-radius);
    padding: 15px 20px;
    border: none;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.alert-premium.critico {
    background: rgba(220, 53, 69, 0.1);
    border-left: 4px solid var(--perigo);
    color: var(--perigo);
}

.alert-premium.atencao {
    background: rgba(255, 193, 7, 0.1);
    border-left: 4px solid var(--alerta);
    color: #856404;
}

.alert-premium.sucesso {
    background: rgba(40, 167, 69, 0.1);
    border-left: 4px solid var(--sucesso);
    color: var(--sucesso);
}

.alert-premium.info {
    background: rgba(23, 162, 184, 0.1);
    border-left: 4px solid var(--info);
    color: var(--info);
}

/* ── GUT Matrix ──────────────────────────────────────────────────────────── */
.gut-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1rem;
    color: var(--branco);
}

.gut-critica { background: var(--perigo); }
.gut-alta { background: #fd7e14; }
.gut-media { background: var(--alerta); color: #333; }
.gut-baixa { background: var(--sucesso); }

.gut-bar {
    height: 8px;
    border-radius: 4px;
    background: var(--cinza-medio);
    overflow: hidden;
}

.gut-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ── Progress Bar ────────────────────────────────────────────────────────── */
.progress-premium {
    height: 10px;
    border-radius: 5px;
    background: var(--cinza-medio);
    overflow: hidden;
}

.progress-premium .progress-bar {
    background: linear-gradient(90deg, var(--dourado), var(--dourado-claro));
    border-radius: 5px;
    transition: width 0.6s ease;
}

/* ── Login Page ──────────────────────────────────────────────────────────── */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--azul-escuro) 0%, var(--azul-medio) 50%, #0d2137 100%);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(201, 168, 76, 0.1), transparent);
    top: -100px;
    right: -100px;
    border-radius: 50%;
}

.login-container::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(201, 168, 76, 0.05), transparent);
    bottom: -50px;
    left: -50px;
    border-radius: 50%;
}

.login-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(201, 168, 76, 0.2);
    border-radius: 20px;
    padding: 50px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

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

.login-logo img {
    max-width: 200px;
    height: auto;
}

.login-title {
    text-align: center;
    color: var(--branco);
    font-size: 1.5rem;
    font-weight: 300;
    margin-bottom: 30px;
}

.login-title span {
    color: var(--dourado);
    font-weight: 600;
}

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

.login-form label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    margin-bottom: 8px;
    display: block;
}

.login-form .form-control {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(201, 168, 76, 0.3);
    color: var(--branco);
    padding: 12px 15px;
    border-radius: 10px;
    width: 100%;
    transition: var(--transition);
}

.login-form .form-control:focus {
    border-color: var(--dourado);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
    outline: none;
}

.login-form .form-control::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--dourado), var(--dourado-claro));
    color: var(--azul-escuro);
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-btn:hover {
    background: linear-gradient(135deg, var(--dourado-hover), var(--dourado));
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(201, 168, 76, 0.4);
}

/* Responsive movido para bloco unico */

/* ── Loading / HTMX ─────────────────────────────────────────────────────── */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-request.htmx-indicator {
    display: inline-block;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--cinza-medio);
    border-top-color: var(--dourado);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.slide-in {
    animation: slideIn 0.4s ease forwards;
}

/* ── Charts Container ────────────────────────────────────────────────────── */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    padding: 10px;
}

/* ── Tooltip ─────────────────────────────────────────────────────────────── */
.tooltip-premium {
    position: relative;
    cursor: help;
}

.tooltip-premium::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--azul-escuro);
    color: var(--branco);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.tooltip-premium:hover::after {
    opacity: 1;
}

/* ── Print ───────────────────────────────────────────────────────────────── */
@media print {
    .sidebar, .topbar, .btn-premium, .btn-azul { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .card-premium { box-shadow: none !important; border: 1px solid #ddd; }
}

/* ============================================
   MELHORIAS SIDEBAR v2
   ============================================ */

.sidebar-brand-empresa {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--dourado);
    text-align: center;
    padding: 0 15px;
    line-height: 1.3;
}

.sidebar-brand {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 2px;
    margin-bottom: 10px;
}

.sidebar-logo-bottom {
    text-align: center;
    padding: 15px 0 5px !important;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 10px;
}

.sidebar-logo-img {
    max-width: 120px;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.sidebar-logo-img:hover {
    opacity: 1;
}

.menu-link-sair {
    color: #dc3545 !important;
}

.menu-link-sair:hover {
    background: rgba(220,53,69,0.1) !important;
}

/* Notificacao badge */
.notif-badge {
    background: #dc3545;
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    font-weight: 700;
}

/* Menu arrow */
.menu-arrow {
    font-size: 0.7rem;
    margin-left: auto;
    transition: transform 0.3s;
}

.menu-arrow.rotated {
    transform: rotate(180deg);
}

/* Submenu */
.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.submenu.show {
    max-height: 500px;
}

.submenu .menu-link {
    padding-left: 45px !important;
    font-size: 0.85rem;
}

/* Menu link active */
.menu-link.active {
    background: rgba(201, 168, 76, 0.15);
    color: var(--dourado) !important;
    border-right: 3px solid var(--dourado);
}

/* Modo Reuniao */
.sidebar-hidden {
    transform: translateX(-100%);
    position: absolute;
}

.main-fullscreen {
    margin-left: 0 !important;
    width: 100% !important;
}

/* Sidebar collapsed */
.sidebar-collapsed {
    width: 70px;
}

.sidebar-collapsed .sidebar-brand-empresa,
.sidebar-collapsed .sidebar-brand,
.sidebar-collapsed .menu-label,
.sidebar-collapsed .menu-link span,
.sidebar-collapsed .menu-arrow,
.sidebar-collapsed .notif-badge,
.sidebar-collapsed .sidebar-logo-bottom {
    display: none;
}

.sidebar-collapsed .menu-link {
    justify-content: center;
    padding: 12px 0;
}

.sidebar-collapsed .menu-link i {
    margin-right: 0;
    font-size: 1.2rem;
}

.main-expanded {
    margin-left: 70px !important;
}

/* Foto perfil dashboard */
.perfil-avatar-grande {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid var(--dourado);
    object-fit: cover;
    box-shadow: 0 4px 15px rgba(201, 168, 76, 0.3);
}

.perfil-avatar-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid var(--dourado);
    background: var(--azul-escuro);
    color: var(--dourado);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(201, 168, 76, 0.3);
}

/* Paginacao */
.pagination-premium {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 20px;
}

.pagination-premium a,
.pagination-premium span {
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85rem;
    border: 1px solid #ddd;
    color: var(--azul-escuro);
}

.pagination-premium .active {
    background: var(--dourado);
    color: #fff;
    border-color: var(--dourado);
}

.pagination-premium a:hover {
    background: var(--cinza-claro);
}

/* Pesquisa */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 35px;
    border-radius: 8px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

/* Print */
@media print {
    .sidebar, .topbar, .no-print {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    .page-content {
        padding: 0 !important;
    }
}

/* ============================================
   FIX: Sidebar + Sair + Modo Reuniao
   ============================================ */

.sidebar {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu .menu-link-sair {
    color: #dc3545 !important;
    margin-top: auto;
}

.sidebar-logo-bottom {
    text-align: center;
    padding: 15px 0 5px !important;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: auto !important;
}

.sidebar-logo-img {
    max-width: 120px;
    opacity: 0.7;
}

/* Garantir sidebar-hidden funciona */
.sidebar-hidden {
    transform: translateX(-100%) !important;
    position: absolute !important;
}

.main-fullscreen {
    margin-left: 0 !important;
    width: 100% !important;
}

/* Sidebar collapsed */
.sidebar-collapsed {
    width: 70px !important;
}

.sidebar-collapsed .sidebar-brand-empresa,
.sidebar-collapsed .sidebar-brand,
.sidebar-collapsed .menu-label,
.sidebar-collapsed .menu-arrow,
.sidebar-collapsed .notif-badge,
.sidebar-collapsed .sidebar-logo-bottom {
    display: none !important;
}

.sidebar-collapsed .menu-link {
    justify-content: center;
    padding: 12px 0;
}

.sidebar-collapsed .menu-link i {
    margin-right: 0;
    font-size: 1.2rem;
}

.main-expanded {
    margin-left: 70px !important;
}

/* Submenu fix */
.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.submenu.show {
    max-height: 500px;
}

.submenu .menu-link {
    padding-left: 45px !important;
    font-size: 0.85rem;
}

.menu-arrow {
    font-size: 0.7rem;
    margin-left: auto;
    transition: transform 0.3s;
}

.menu-arrow.rotated {
    transform: rotate(180deg);
}

.menu-link.active {
    background: rgba(201, 168, 76, 0.15);
    color: var(--dourado) !important;
    border-right: 3px solid var(--dourado);
}

.notif-badge {
    background: #dc3545;
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    font-weight: 700;
}

/* Perfil avatar */
.perfil-avatar-grande {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid var(--dourado);
    object-fit: cover;
    box-shadow: 0 4px 15px rgba(201, 168, 76, 0.3);
}

.perfil-avatar-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid var(--dourado);
    background: var(--azul-escuro);
    color: var(--dourado);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}

/* Paginacao */
.pagination-premium {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination-premium a,
.pagination-premium span {
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85rem;
    border: 1px solid #ddd;
    color: var(--azul-escuro);
}

.pagination-premium .active {
    background: var(--dourado);
    color: #fff;
    border-color: var(--dourado);
}

/* Search box */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 35px;
    border-radius: 8px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

/* Print */
@media print {
    .sidebar, .topbar, .no-print {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

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

/* Botao Sair centralizado */
.menu-link-sair {
    color: #dc3545 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Mobile movido para bloco unico */

    .page-header {
        flex-direction: column;
        gap: 10px;
    }

    .card-premium .card-body {
        padding: 15px;
    }

    .table-premium {
        font-size: 0.8rem;
    }

    .table-premium th,
    .table-premium td {
        padding: 8px 10px;
    }

    .kpi-card {
        padding: 15px;
    }

    .kpi-value {
        font-size: 1.2rem;
    }

    .d-flex.gap-2,
    .d-flex.gap-3 {
        flex-wrap: wrap;
    }

    .btn-premium,
    .btn-outline-premium {
        font-size: 0.85rem;
        padding: 8px 15px;
    }

    .row.g-4 {
        --bs-gutter-x: 0.5rem;
        --bs-gutter-y: 0.5rem;
    }

    /* Perfil avatar menor no mobile */
    .perfil-avatar-grande {
        width: 80px;
        height: 80px;
    }

    .perfil-avatar-placeholder {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }

    /* Overlay quando sidebar aberto */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Formularios */
    .form-premium .row {
        flex-direction: column;
    }

    .form-premium .col-md-4,
    .form-premium .col-md-6,
    .form-premium .col-md-8 {
        width: 100%;
    }

    /* Paginacao */
    .pagination-premium {
        flex-wrap: wrap;
        gap: 3px;
    }

    .pagination-premium a,
    .pagination-premium span {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    /* Sidebar header */
    .sidebar-header {
        padding: 15px 10px;
    }

    .sidebar-brand-empresa {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .topbar-user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    h1, h2 {
        font-size: 1.3rem;
    }

    h3, h4 {
        font-size: 1.1rem;
    }

    .card-premium {
        border-radius: 10px;
    }
}

/* ============================================
   FIX SUBMENU - GARANTIR FUNCIONAMENTO
   ============================================ */
.sidebar-menu .submenu {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    transition: max-height 0.4s ease !important;
}

.sidebar-menu .submenu.show {
    max-height: 600px !important;
    overflow: visible !important;
}

.sidebar-menu .submenu li {
    list-style: none;
}

.sidebar-menu .submenu .menu-link {
    padding: 8px 15px 8px 45px !important;
    font-size: 0.85rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    color: rgba(255,255,255,0.7) !important;
    text-decoration: none !important;
}

.sidebar-menu .submenu .menu-link:hover {
    color: var(--dourado) !important;
    background: rgba(201, 168, 76, 0.1) !important;
}

.sidebar-menu .submenu .menu-link.active {
    color: var(--dourado) !important;
    background: rgba(201, 168, 76, 0.15) !important;
}

.menu-toggle {
    cursor: pointer !important;
}

.menu-arrow {
    font-size: 0.7rem !important;
    margin-left: auto !important;
    transition: transform 0.3s ease !important;
}

.menu-arrow.rotated {
    transform: rotate(180deg) !important;
}

/* Sidebar overlay mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* ============================================
   TEMA ESCURO - Apenas area de conteudo
   Sidebar NAO muda
   ============================================ */


/* Metabase iframe escuro */


/* Dourado continua dourado em ambos os temas */


/* ============================================
   METABASE EMBED
   ============================================ */
.metabase-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden;
    margin-bottom: 20px;
}


.metabase-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--azul-escuro);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
}

.metabase-actions {
    margin-left: auto;
    display: flex;
    gap: 5px;
}

.metabase-actions .btn {
    color: rgba(255,255,255,0.7);
    padding: 2px 8px;
}

.metabase-actions .btn:hover {    color: var(--dourado);
}

.metabase-body {
    position: relative;
    min-height: 400px;
}

.metabase-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #999;
    z-index: 5;
}

.metabase-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
}

.metabase-container.fullscreen iframe {
    height: calc(100vh - 50px) !important;
}

.metabase-container.fullscreen .metabase-header {
    border-radius: 0;
}

/* ══════════════════════════════════════════════════════════════
   SUBMENUS - Desktop e Mobile
   ══════════════════════════════════════════════════════════════ */

.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0,0,0,0.05);
}

.submenu.show {
    max-height: 500px !important;
    overflow: visible;
}

.submenu li a {
    padding: 8px 15px 8px 40px !important;
    font-size: 0.85rem;
    display: block;
    color: inherit;
    text-decoration: none;
}

.submenu li a:hover {
    background: rgba(201, 168, 76, 0.1);
    color: var(--dourado) !important;
}

.submenu li a.active {
    color: var(--dourado) !important;
    font-weight: 600;
}

.menu-arrow {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.menu-toggle.open .menu-arrow {
    transform: rotate(180deg);
}

/* Tema escuro submenus */

/* ══════════════════════════════════════════════════════════════
   MOBILE - BLOCO UNICO DEFINITIVO
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    /* Sidebar escondido por padrao */
    .sidebar {
        position: fixed !important;
        left: -280px !important;
        top: 0 !important;
        width: 280px !important;
        height: 100vh !important;
        z-index: 1050 !important;
        transition: left 0.3s ease !important;
        overflow-y: auto !important;
        transform: none !important;
    }

    /* Sidebar visivel */
    .sidebar.sidebar-open,
    .sidebar.show {
        left: 0 !important;
        transform: none !important;
    }

    /* Main content sem margem */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Topbar compacto */
    .topbar {
        padding: 8px 12px !important;
    }

    .topbar-title {
        font-size: 0.85rem;
    }

    .topbar-user-info {
        display: none !important;
    }

    /* Hamburger sempre visivel */
    #sidebar-toggle {
        display: block !important;
    }

    #btnTema {
        display: block !important;
    }

    /* Conteudo */
    .page-content {
        padding: 12px !important;
    }

    /* KPIs */
    .kpi-value {
        font-size: 1.2rem;
    }

    .kpi-card {
        margin-bottom: 10px;
    }

    /* Cards */
    .card-premium {
        margin-bottom: 12px;
    }

    /* Tabelas */
    .table-responsive {
        overflow-x: auto;
    }

    /* Visao Executiva KPIs */
    .kpi-exec {
        padding: 10px 8px !important;
    }

    .kpi-exec-value {
        font-size: 0.85rem !important;
    }
}

/* ══════════════════════════════════════════════════════════════
   TEMA ESCURO - Cinza Medio Premium
   ══════════════════════════════════════════════════════════════ */

body.tema-escuro {
    background: #2d2d2e !important;
    color: #f0f0f0 !important;
}

/* Sidebar */
body.tema-escuro .sidebar {
    background: #383839 !important;
    border-right: 1px solid #505052 !important;
}

body.tema-escuro .sidebar-header {
    border-bottom: 1px solid #505052 !important;
}

body.tema-escuro .sidebar-brand-empresa,
body.tema-escuro .sidebar-brand {
    color: #e0e0e0 !important;
}

body.tema-escuro .menu-label {
    color: #999 !important;
}

body.tema-escuro .menu-link {
    color: #d0d0d0 !important;
}

body.tema-escuro .menu-link:hover,
body.tema-escuro .menu-link.active {
    background: rgba(201, 168, 76, 0.15) !important;
    color: #c9a84c !important;
}

body.tema-escuro .submenu {
    background: #333334 !important;
}

body.tema-escuro .submenu a {
    color: #c0c0c0 !important;
}

body.tema-escuro .submenu a:hover,
body.tema-escuro .submenu a.active {
    color: #c9a84c !important;
}

/* Topbar */
body.tema-escuro .topbar {
    background: #383839 !important;
    border-bottom: 1px solid #505052 !important;
}

body.tema-escuro .topbar * {
    color: #e0e0e0 !important;
}

body.tema-escuro #sidebar-toggle i,
body.tema-escuro #btnTema i {
    color: #c9a84c !important;
}

/* Main content */
body.tema-escuro .main-content,
body.tema-escuro .page-content {
    background: #2d2d2e !important;
}

/* Cards */
body.tema-escuro .card,
body.tema-escuro .card-premium {
    background: #3a3a3b !important;
    border: 1px solid #505052 !important;
}

body.tema-escuro .card-header,
body.tema-escuro .card-premium .card-header {
    background: #424243 !important;
    border-bottom: 1px solid #505052 !important;
}

body.tema-escuro .card-body,
body.tema-escuro .card-premium .card-body {
    background: #3a3a3b !important;
}

/* Textos - herdam cor do body */
body.tema-escuro h1, body.tema-escuro h2, body.tema-escuro h3,
body.tema-escuro h4, body.tema-escuro h5, body.tema-escuro h6 {
    color: #f0f0f0 !important;
}

body.tema-escuro p, body.tema-escuro span, body.tema-escuro div,
body.tema-escuro label, body.tema-escuro small, body.tema-escuro li,
body.tema-escuro strong, body.tema-escuro b, body.tema-escuro em {
    color: #e0e0e0 !important;
}

body.tema-escuro .text-muted {
    color: #aaa !important;
}

/* Tabelas */
body.tema-escuro table,
body.tema-escuro .table-premium {
    color: #e0e0e0 !important;
}

body.tema-escuro thead,
body.tema-escuro .table-premium thead {
    background: #424243 !important;
}

body.tema-escuro thead th {
    color: #c9a84c !important;
}

body.tema-escuro tbody tr {
    border-bottom: 1px solid #505052 !important;
}

body.tema-escuro tbody tr:hover {
    background: rgba(201, 168, 76, 0.08) !important;
}

body.tema-escuro td, body.tema-escuro th {
    color: #e0e0e0 !important;
}

/* KPI Cards */
body.tema-escuro .kpi-card {
    background: #3a3a3b !important;
    border: 1px solid #505052 !important;
}

body.tema-escuro .kpi-value {
    color: #f0f0f0 !important;
}

body.tema-escuro .kpi-label {
    color: #aaa !important;
}

body.tema-escuro .kpi-icon {
    color: #c9a84c !important;
}

/* Forms */
body.tema-escuro .form-control,
body.tema-escuro .form-select,
body.tema-escuro select,
body.tema-escuro input,
body.tema-escuro textarea {
    background: #454546 !important;
    border: 1px solid #606062 !important;
    color: #f0f0f0 !important;
}

body.tema-escuro .form-control:focus,
body.tema-escuro .form-select:focus {
    border-color: #c9a84c !important;
    box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.25) !important;
}

/* Botoes */
body.tema-escuro .btn-premium {
    background: transparent !important;
    border: 2px solid #c9a84c !important;
    color: #c9a84c !important;
}

body.tema-escuro .btn-premium:hover {
    background: rgba(201, 168, 76, 0.15) !important;
    color: #c9a84c !important;
    border-color: #c9a84c !important;
}

body.tema-escuro .btn-outline-premium {
    border-color: #c9a84c !important;
    color: #c9a84c !important;
}

/* Dropdown */
body.tema-escuro .dropdown-menu {
    background: #3a3a3b !important;
    border: 1px solid #505052 !important;
}

body.tema-escuro .dropdown-item {
    color: #d0d0d0 !important;
}

body.tema-escuro .dropdown-item:hover {
    background: #454546 !important;
    color: #c9a84c !important;
}

/* Modal */
body.tema-escuro .modal-content {
    background: #3a3a3b !important;
    border: 1px solid #505052 !important;
}

/* Alerts */
body.tema-escuro .alert {
    border: 1px solid #505052 !important;
}

/* Progress */
body.tema-escuro .progress {
    background: #505052 !important;
}

/* Badges */
body.tema-escuro .badge {
    color: #f0f0f0 !important;
}

/* Links */
body.tema-escuro a:not(.btn):not(.menu-link):not(.nav-link) {
    color: #c9a84c !important;
}

/* Dourado preservar */
body.tema-escuro .dourado {
    color: #c9a84c !important;
}

/* Tabs */
body.tema-escuro .nav-tabs .nav-link {
    color: #aaa !important;
}

body.tema-escuro .nav-tabs .nav-link.active {
    background: #3a3a3b !important;
    color: #c9a84c !important;
    border-color: #505052 !important;
}

/* Visao Executiva - hero (manter escuro original) */
body.tema-escuro .exec-hero {
    background: linear-gradient(135deg, #1a2332 0%, #0d1117 100%) !important;
}

body.tema-escuro .exec-hero * {
    color: #fff !important;
}

body.tema-escuro .exec-hero .kpi-exec-label {
    color: rgba(255,255,255,0.5) !important;
}

/* Visao Executiva - secoes */
body.tema-escuro .exec-decisao,
body.tema-escuro .exec-verdade,
body.tema-escuro .exec-driver,
body.tema-escuro .exec-alerta {
    background: #3a3a3b !important;
    border-color: #505052 !important;
}

/* Inline styles override */
body.tema-escuro [style*="color: #1"],
body.tema-escuro [style*="color: #2"],
body.tema-escuro [style*="color: #3"],
body.tema-escuro [style*="color:#1"],
body.tema-escuro [style*="color:#2"],
body.tema-escuro [style*="color:#3"] {
    color: #e0e0e0 !important;
}

body.tema-escuro [style*="color: #666"],
body.tema-escuro [style*="color:#666"],
body.tema-escuro [style*="color: #888"],
body.tema-escuro [style*="color:#888"],
body.tema-escuro [style*="color: #999"],
body.tema-escuro [style*="color:#999"] {
    color: #aaa !important;
}

body.tema-escuro [style*="background: #f"],
body.tema-escuro [style*="background:#f"],
body.tema-escuro [style*="background: #e"],
body.tema-escuro [style*="background:#e"],
body.tema-escuro [style*="background: white"],
body.tema-escuro [style*="background: #fff"],
body.tema-escuro [style*="background:#fff"] {
    background: #3a3a3b !important;
}

/* Scrollbar */
body.tema-escuro ::-webkit-scrollbar {
    background: #2d2d2e;
}

body.tema-escuro ::-webkit-scrollbar-thumb {
    background: #505052;
    border-radius: 4px;
}

body.tema-escuro ::-webkit-scrollbar-thumb:hover {
    background: #606062;
}

/* Striped tables */
body.tema-escuro .table-striped tbody tr:nth-of-type(odd) {
    background: rgba(255,255,255,0.03) !important;
}

/* Insight cards */
body.tema-escuro [class*="insight"] {
    background: #3a3a3b !important;
    color: #e0e0e0 !important;
}

/* Breadcrumb */
body.tema-escuro .breadcrumb-item,
body.tema-escuro .breadcrumb-item a {
    color: #aaa !important;
}

/* Overlay mobile */
body.tema-escuro .sidebar-overlay.active {
    background: rgba(0,0,0,0.6) !important;
}

/* ══════════════════════════════════════════════════════════════
   TEMA ESCURO - FIXES ESPECIFICOS
   ══════════════════════════════════════════════════════════════ */

/* Dashboard - Alertas/Insights com fundo colorido */
body.tema-escuro .alert-warning,
body.tema-escuro .alert-danger,
body.tema-escuro .alert-success,
body.tema-escuro .alert-info {
    color: #1a1a1b !important;
}

body.tema-escuro .alert-warning * ,
body.tema-escuro .alert-danger *,
body.tema-escuro .alert-success *,
body.tema-escuro .alert-info * {
    color: #1a1a1b !important;
}

body.tema-escuro [style*="background: #fff3cd"],
body.tema-escuro [style*="background:#fff3cd"],
body.tema-escuro [style*="background-color: #fff3cd"],
body.tema-escuro [style*="background: #ffc107"],
body.tema-escuro [style*="background:#ffc107"] {
    background: #5a4800 !important;
    color: #ffd54f !important;
}

body.tema-escuro [style*="background: #fff3cd"] *,
body.tema-escuro [style*="background:#fff3cd"] *,
body.tema-escuro [style*="background-color: #fff3cd"] *,
body.tema-escuro [style*="background: #ffc107"] *,
body.tema-escuro [style*="background:#ffc107"] * {
    color: #ffd54f !important;
}

/* Insight cards com cores especificas */
body.tema-escuro [style*="border-left: 4px solid #dc3545"],
body.tema-escuro [style*="border-left:4px solid #dc3545"],
body.tema-escuro [style*="border-left: 3px solid #dc3545"] {
    background: #3a2020 !important;
}

body.tema-escuro [style*="border-left: 4px solid #ffc107"],
body.tema-escuro [style*="border-left:4px solid #ffc107"],
body.tema-escuro [style*="border-left: 3px solid #ffc107"] {
    background: #3a3520 !important;
}

body.tema-escuro [style*="border-left: 4px solid #28a745"],
body.tema-escuro [style*="border-left:4px solid #28a745"],
body.tema-escuro [style*="border-left: 3px solid #28a745"] {
    background: #203a25 !important;
}

/* Visao Executiva - Radar Chart labels e linhas */
body.tema-escuro #radarChart {
    filter: none !important;
}

/* Mapa de Riscos - barras de progresso coloridas */
body.tema-escuro .progress-bar {
    opacity: 1 !important;
}

body.tema-escuro .progress-bar[style*="background: #ffc107"],
body.tema-escuro .progress-bar[style*="background:#ffc107"],
body.tema-escuro [style*="background: #ffc107"],
body.tema-escuro [style*="background:#ffc107"] {
    background: #ffc107 !important;
}

body.tema-escuro .progress-bar[style*="background: #fd7e14"],
body.tema-escuro .progress-bar[style*="background:#fd7e14"],
body.tema-escuro [style*="background: #fd7e14"],
body.tema-escuro [style*="background:#fd7e14"] {
    background: #fd7e14 !important;
}

body.tema-escuro .progress-bar[style*="background: #28a745"],
body.tema-escuro .progress-bar[style*="background:#28a745"],
body.tema-escuro [style*="background: #28a745"],
body.tema-escuro [style*="background:#28a745"] {
    background: #28a745 !important;
}

body.tema-escuro .progress-bar[style*="background: #dc3545"],
body.tema-escuro .progress-bar[style*="background:#dc3545"],
body.tema-escuro [style*="background: #dc3545"],
body.tema-escuro [style*="background:#dc3545"] {
    background: #dc3545 !important;
}

/* Indicadores Criticos/Atencao/Positivos - preservar cores */
body.tema-escuro [style*="color: #dc3545"],
body.tema-escuro [style*="color:#dc3545"] {
    color: #ff6b6b !important;
}

body.tema-escuro [style*="color: #ffc107"],
body.tema-escuro [style*="color:#ffc107"] {
    color: #ffd54f !important;
}

body.tema-escuro [style*="color: #28a745"],
body.tema-escuro [style*="color:#28a745"] {
    color: #51cf66 !important;
}

body.tema-escuro [style*="color: #fd7e14"],
body.tema-escuro [style*="color:#fd7e14"] {
    color: #ff9f43 !important;
}

/* Badges com cores - preservar fundo e texto */
body.tema-escuro .badge[style*="background: #dc3545"],
body.tema-escuro .badge[style*="background:#dc3545"],
body.tema-escuro .badge[style*="background-color: #dc3545"] {
    background: #dc3545 !important;
    color: #fff !important;
}

body.tema-escuro .badge[style*="background: #ffc107"],
body.tema-escuro .badge[style*="background:#ffc107"],
body.tema-escuro .badge[style*="background-color: #ffc107"] {
    background: #ffc107 !important;
    color: #1a1a1b !important;
}

body.tema-escuro .badge[style*="background: #28a745"],
body.tema-escuro .badge[style*="background:#28a745"],
body.tema-escuro .badge[style*="background-color: #28a745"] {
    background: #28a745 !important;
    color: #fff !important;
}

body.tema-escuro .badge[style*="background: #17a2b8"],
body.tema-escuro .badge[style*="background:#17a2b8"] {
    background: #17a2b8 !important;
    color: #fff !important;
}

body.tema-escuro .badge * {
    color: inherit !important;
}

/* Resumo insights - Criticos/Atencao/Positivos numeros */
body.tema-escuro [style*="font-weight:700"][style*="color:#dc3545"],
body.tema-escuro [style*="font-weight: 700"][style*="color: #dc3545"],
body.tema-escuro [style*="font-weight:700"][style*="color:#28a745"],
body.tema-escuro [style*="font-weight: 700"][style*="color: #28a745"],
body.tema-escuro [style*="font-weight:700"][style*="color:#ffc107"],
body.tema-escuro [style*="font-weight: 700"][style*="color: #ffc107"] {
    color: inherit !important;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVIDADE MOBILE - MELHORIAS
   ══════════════════════════════════════════════════════════════ */

/* ── Tablet (768-1024px) ─────────────────────────────────────── */
@media (max-width: 1024px) and (min-width: 769px) {
    .sidebar {
        width: 220px !important;
    }
    .main-content {
        margin-left: 220px !important;
    }
    .page-content {
        padding: 15px !important;
    }
    .kpi-card {
        padding: 12px !important;
    }
    .kpi-value {
        font-size: 1.3rem !important;
    }
}

/* ── Mobile (max 768px) - Reforcos ───────────────────────────── */
@media (max-width: 768px) {
    /* Garantir sidebar escondido */
    .sidebar {
        position: fixed !important;
        left: -280px !important;
        top: 0 !important;
        width: 280px !important;
        height: 100vh !important;
        z-index: 1050 !important;
        transition: left 0.3s ease !important;
    }
    .sidebar.sidebar-open {
        left: 0 !important;
    }
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Topbar compacto */
    .topbar {
        padding: 6px 10px !important;
        flex-wrap: nowrap !important;
    }
    .topbar-title {
        font-size: 0.8rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 140px;
    }
    .topbar-user-info {
        display: none !important;
    }
    #btn-modo-reuniao {
        display: none !important;
    }

    /* Page content */
    .page-content {
        padding: 10px !important;
    }

    /* KPI Cards - 2 por linha */
    .row .col-md-3,
    .row .col-lg-3,
    .row .col-xl-3 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
    .kpi-card {
        padding: 10px !important;
        margin-bottom: 8px !important;
    }
    .kpi-value {
        font-size: 1rem !important;
    }
    .kpi-label {
        font-size: 0.7rem !important;
    }
    .kpi-change {
        font-size: 0.65rem !important;
    }

    /* Cards */
    .card-premium {
        margin-bottom: 10px !important;
        border-radius: 8px !important;
    }
    .card-premium .card-header {
        padding: 10px 12px !important;
        font-size: 0.85rem !important;
    }
    .card-premium .card-body {
        padding: 10px 12px !important;
    }

    /* Tabelas responsivas */
    .table-premium {
        font-size: 0.75rem !important;
    }
    .table-premium thead th {
        padding: 6px 4px !important;
        font-size: 0.7rem !important;
    }
    .table-premium tbody td {
        padding: 5px 4px !important;
    }
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Graficos */
    canvas {
        max-height: 250px !important;
    }

    /* Score financeiro */
    .score-circle {
        width: 80px !important;
        height: 80px !important;
    }
    .score-value {
        font-size: 1.2rem !important;
    }

    /* Visao Executiva */
    .kpi-exec {
        padding: 8px 6px !important;
    }
    .kpi-exec-value {
        font-size: 0.8rem !important;
    }
    .kpi-exec-label {
        font-size: 0.65rem !important;
    }

    /* Headings */
    h1, .h1 { font-size: 1.3rem !important; }
    h2, .h2 { font-size: 1.15rem !important; }
    h3, .h3 { font-size: 1rem !important; }
    h4, .h4 { font-size: 0.9rem !important; }

    /* Botoes */
    .btn-sm {
        padding: 4px 8px !important;
        font-size: 0.75rem !important;
    }
    .btn {
        font-size: 0.8rem !important;
    }

    /* Alerts */
    .alert {
        font-size: 0.8rem !important;
        padding: 8px 12px !important;
    }

    /* Formularios */
    .form-control, .form-select {
        font-size: 0.85rem !important;
    }

    /* Badges */
    .badge {
        font-size: 0.65rem !important;
    }

    /* Modais */
    .modal-dialog {
        margin: 10px !important;
        max-width: calc(100% - 20px) !important;
    }

    /* DR / Balanco tabelas */
    .dr-table td:first-child,
    .dr-table th:first-child {
        min-width: 120px !important;
        white-space: nowrap;
    }

    /* Forecast comparativo */
    .forecast-table {
        font-size: 0.7rem !important;
    }

    /* Ocultar elementos nao essenciais */
    .d-mobile-none {
        display: none !important;
    }
}

/* ── Mobile pequeno (max 480px) ──────────────────────────────── */
@media (max-width: 480px) {
    /* KPI Cards - 1 por linha */
    .row .col-md-3,
    .row .col-lg-3,
    .row .col-xl-3 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    .topbar-title {
        max-width: 100px !important;
        font-size: 0.75rem !important;
    }

    .page-content {
        padding: 8px !important;
    }

    .kpi-value {
        font-size: 0.9rem !important;
    }

    .table-premium {
        font-size: 0.65rem !important;
    }
    .table-premium thead th,
    .table-premium tbody td {
        padding: 4px 3px !important;
    }

    canvas {
        max-height: 200px !important;
    }

    h1, .h1 { font-size: 1.1rem !important; }
    h2, .h2 { font-size: 1rem !important; }
}

/* ── Sidebar hidden (Modo Reuniao) ───────────────────────────── */
.sidebar.sidebar-hidden {
    left: -280px !important;
    position: fixed !important;
}
.main-content.main-fullscreen {
    margin-left: 0 !important;
    width: 100% !important;
}

/* ── Sidebar collapsed (Desktop) ─────────────────────────────── */
.sidebar.sidebar-collapsed {
    width: 60px !important;
    overflow: hidden !important;
}
.sidebar.sidebar-collapsed .menu-text,
.sidebar.sidebar-collapsed .menu-label,
.sidebar.sidebar-collapsed .menu-arrow,
.sidebar.sidebar-collapsed .sidebar-brand,
.sidebar.sidebar-collapsed .sidebar-brand-empresa,
.sidebar.sidebar-collapsed .sidebar-logo-img,
.sidebar.sidebar-collapsed .submenu,
.sidebar.sidebar-collapsed .notif-badge {
    display: none !important;
}
.sidebar.sidebar-collapsed .menu-link {
    justify-content: center !important;
    padding: 12px 0 !important;
}
.sidebar.sidebar-collapsed .menu-link i {
    font-size: 1.2rem !important;
    margin: 0 !important;
}
.main-content.main-expanded {
    margin-left: 60px !important;
}

/* ── Metabase iframes responsivos ────────────────────────────── */
.metabase-embed,
iframe[src*="metabase"] {
    width: 100% !important;
    min-height: 400px;
    border: none;
    border-radius: 8px;
}
@media (max-width: 768px) {
    .metabase-embed,
    iframe[src*="metabase"] {
        min-height: 300px !important;
    }
}

/* ── Fix Sidebar Mobile - Sair sempre visivel ────────────────── */
@media (max-width: 768px) {
    .sidebar-menu {
        display: flex !important;
        flex-direction: column !important;
        min-height: calc(100vh - 80px) !important;
    }
    .sidebar-logo-bottom {
        margin-top: auto !important;
    }
    .sidebar-logo-bottom .sidebar-logo-img {
        max-width: 80px !important;
    }
    .menu-link-sair {
        position: sticky !important;
        bottom: 0 !important;
        background: var(--azul-escuro, #1a1a2e) !important;
        border-top: 1px solid rgba(255,255,255,0.15) !important;
        padding: 12px 15px !important;
        margin: 0 !important;
    }
}

/* ── Fix Sidebar Mobile - Sair FORCADO ───────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        display: flex !important;
        flex-direction: column !important;
    }
    .sidebar-menu {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 !important;
        overflow-y: auto !important;
        padding-bottom: 60px !important;
    }
    .sidebar-menu > li:last-child {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 280px !important;
        background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%) !important;
        border-top: 1px solid rgba(201,168,76,0.3) !important;
        z-index: 1060 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .sidebar-menu > li:last-child .menu-link {
        padding: 14px 20px !important;
        font-size: 0.95rem !important;
    }
}

/* ── Anti-flash tema escuro ──────────────────────────────────────────── */
body.tema-escuro {
    background-color: #1a1a1b !important;
}

/* Prevenir flash branco na transicao de pagina */
html.tema-escuro {
    background-color: #1a1a1b !important;
}

/* Simulador cenarios - cards transparentes */
body.tema-escuro .card-premium .table,
body.tema-escuro .card-premium .table td,
body.tema-escuro .card-premium .table th {
    background: #2a2a2b !important;
    color: #e0e0e0 !important;
    border-color: #505052 !important;
}

body.tema-escuro .card-premium .table thead th {
    background: #333335 !important;
    color: #c9a84c !important;
}

/* Matriz de Riscos - fonte visivel */
body.tema-escuro .risk-cell,
body.tema-escuro .risk-matrix td,
body.tema-escuro .risk-matrix span,
body.tema-escuro [class*="risk-"] span {
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8) !important;
}

/* Ranking de Riscos - fundo escuro */
body.tema-escuro .card,
body.tema-escuro .card-body {
    background: #2a2a2b !important;
    color: #e0e0e0 !important;
    border-color: #505052 !important;
}

body.tema-escuro .card-header {
    background: #333335 !important;
    color: #c9a84c !important;
    border-color: #505052 !important;
}

/* FMEA tabela - fundo escuro */
body.tema-escuro table,
body.tema-escuro table td,
body.tema-escuro table th,
body.tema-escuro thead {
    background: #2a2a2b !important;
    color: #e0e0e0 !important;
    border-color: #505052 !important;
}

body.tema-escuro thead th,
body.tema-escuro table thead {
    background: #333335 !important;
    color: #c9a84c !important;
}

/* Arvore de Decisao - fundo escuro */
body.tema-escuro .tree-node,
body.tema-escuro .decision-card {
    background: #2a2a2b !important;
    color: #e0e0e0 !important;
    border-color: #505052 !important;
}

/* Ciclo Financeiro - linha legivel */
body.tema-escuro tr[style*="background"],
body.tema-escuro .table-active,
body.tema-escuro .table-secondary {
    background: #3a3a3b !important;
    color: #e0e0e0 !important;
}

/* KPI cards no tema escuro */
body.tema-escuro .kpi-card {
    background: #2a2a2b !important;
    border-color: #505052 !important;
}

body.tema-escuro .kpi-label {
    color: #999 !important;
}

body.tema-escuro .kpi-value {
    color: #e0e0e0 !important;
}

/* Badges e alerts */
body.tema-escuro .alert {
    background: #2a2a2b !important;
    border-color: #505052 !important;
    color: #e0e0e0 !important;
}

/* Form controls */
body.tema-escuro .form-control,
body.tema-escuro .form-select {
    background: #2a2a2b !important;
    color: #e0e0e0 !important;
    border-color: #505052 !important;
}

/* Comparativo cenarios - menos transparente */
body.tema-escuro .table-responsive .table {
    background: #2a2a2b !important;
}

body.tema-escuro .table-responsive .table td {
    background: #2a2a2b !important;
    color: #e0e0e0 !important;
}

/* ── Tema Escuro - Fixes especificos v2 ──────────────────────────────── */

/* Plano de Acao - cards Andamento/Concluido */
body.tema-escuro .card div[style*="color:#004085"],
body.tema-escuro .card div[style*="color:#155724"],
body.tema-escuro .card div[style*="color:#856404"] {
    color: #e0e0e0 !important;
}

body.tema-escuro .card small {
    color: #aaa !important;
}

/* Simulador cenarios - tabela comparativo mais opaca */
body.tema-escuro .table-bordered td,
body.tema-escuro .table-bordered th {
    background-color: #2a2a2b !important;
    color: #e0e0e0 !important;
    border-color: #505052 !important;
    opacity: 1 !important;
}

body.tema-escuro .table-bordered thead th {
    background-color: #333335 !important;
    color: #c9a84c !important;
    opacity: 1 !important;
}

body.tema-escuro .table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: #2f2f30 !important;
}

/* Matriz de Riscos - fonte branca solida */
body.tema-escuro [style*="background-color: #ff"],
body.tema-escuro [style*="background-color: #f4"],
body.tema-escuro [style*="background-color: #fc"],
body.tema-escuro [style*="background-color: #28"],
body.tema-escuro [style*="background-color: #fd"],
body.tema-escuro [style*="background-color: #dc"],
body.tema-escuro [style*="background-color: #ff6"],
body.tema-escuro [style*="background: #"] {
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.9) !important;
}

/* Matriz riscos - celulas com cor de fundo */
body.tema-escuro td[style*="background"],
body.tema-escuro td[style*="Background"] {
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.9) !important;
}

/* Ranking de Riscos e FMEA - card inteiro escuro */
body.tema-escuro .card-premium,
body.tema-escuro .card-premium .card-body,
body.tema-escuro .card-premium .card-header {
    background: #2a2a2b !important;
    color: #e0e0e0 !important;
}

/* Forecast - Ciclo Financeiro linha legivel */
body.tema-escuro tr.table-active td,
body.tema-escuro tr.table-secondary td,
body.tema-escuro tr[class*="table-"] td {
    color: #e0e0e0 !important;
    background: #3a3a3b !important;
}

/* Orcamento/Forecast - botoes outline */
body.tema-escuro .btn-warning,
body.tema-escuro .btn-primary,
body.tema-escuro a.btn-premium,
body.tema-escuro button.btn-premium {
    background: transparent !important;
    border: 2px solid #c9a84c !important;
    color: #c9a84c !important;
}

body.tema-escuro .btn-warning:hover,
body.tema-escuro .btn-primary:hover,
body.tema-escuro a.btn-premium:hover,
body.tema-escuro button.btn-premium:hover {
    background: rgba(201, 168, 76, 0.15) !important;
    color: #c9a84c !important;
}

/* Arvore de Decisao - nodes escuros */
body.tema-escuro div[style*="border-left: 3px"],
body.tema-escuro div[style*="border: 1px solid"],
body.tema-escuro .opcao-card {
    background: #2a2a2b !important;
    color: #e0e0e0 !important;
    border-color: #505052 !important;
}

/* Modal escuro */
body.tema-escuro .modal-content {
    background: #2a2a2b !important;
    color: #e0e0e0 !important;
    border-color: #505052 !important;
}

body.tema-escuro .modal-header {
    border-color: #505052 !important;
}

body.tema-escuro .modal-footer {
    border-color: #505052 !important;
}

/* Inputs no tema escuro */
body.tema-escuro input,
body.tema-escuro select,
body.tema-escuro textarea {
    background: #333335 !important;
    color: #e0e0e0 !important;
    border-color: #505052 !important;
}

/* Links e textos */
body.tema-escuro a:not(.btn):not(.nav-link) {
    color: #c9a84c !important;
}

body.tema-escuro .text-muted {
    color: #888 !important;
}

body.tema-escuro .text-dark {
    color: #e0e0e0 !important;
}

/* Page header */
body.tema-escuro .page-header h2,
body.tema-escuro .page-header h3,
body.tema-escuro h1, body.tema-escuro h2,
body.tema-escuro h3, body.tema-escuro h4 {
    color: #e0e0e0 !important;
}

/* Prevenir qualquer fundo branco residual */
body.tema-escuro .container-fluid,
body.tema-escuro .main-content,
body.tema-escuro main {
    background-color: #1a1a1b !important;
}

/* ── Tema Escuro - Toolkit fixes v3 ──────────────────────────────────── */

/* Matriz de Riscos - heatmap celulas */
body.tema-escuro div[style*="font-weight:bold;color:#666"] {
    color: #ccc !important;
}

body.tema-escuro div[style*="color:#666"],
body.tema-escuro small[style*="color:#666"],
body.tema-escuro p[style*="color:#888"] {
    color: #aaa !important;
}

/* Ranking de Riscos - tabela */
body.tema-escuro table td[style*="padding:10px"],
body.tema-escuro table td[style*="padding:8px"] {
    background: #2a2a2b !important;
    color: #e0e0e0 !important;
    border-color: #505052 !important;
}

body.tema-escuro table td small[style*="color:#666"] {
    color: #999 !important;
}

/* FMEA tabela */
body.tema-escuro table th {
    background: #333335 !important;
    color: #c9a84c !important;
    border-color: #505052 !important;
}

body.tema-escuro table tr {
    border-color: #505052 !important;
}

body.tema-escuro table tr:hover td {
    background: #333335 !important;
}

/* KPI cards no toolkit */
body.tema-escuro .kpi-card,
body.tema-escuro div[class*="kpi"] {
    background: #2a2a2b !important;
    border-color: #505052 !important;
}

/* Card headers com azul escuro */
body.tema-escuro div[style*="background:var(--azul-escuro)"] {
    background: #1a2332 !important;
}

/* Plano de acao - stats cards */
body.tema-escuro div[style*="text-primary"],
body.tema-escuro div[style*="text-success"] {
    color: #e0e0e0 !important;
}

/* Todos os cards com fundo branco */
body.tema-escuro .card-premium > div:not(.card-header) {
    background: #2a2a2b !important;
    color: #e0e0e0 !important;
}

/* Formularios dentro de cards */
body.tema-escuro .card-premium label {
    color: #ccc !important;
}

body.tema-escuro .card-premium .form-label {
    color: #ccc !important;
}

/* Projeto generico - item background */
body.tema-escuro div[style*="background:rgba(0,0,0,0.02)"] {
    background: #333335 !important;
}

/* Arvore decisao - opcao cards */
body.tema-escuro div[style*="border:2px solid"][style*="background:#fff"],
body.tema-escuro div[style*="border:2px solid"][style*="background:var(--bg-card"] {
    background: #2a2a2b !important;
    color: #e0e0e0 !important;
}

body.tema-escuro div[style*="border-left:3px solid var(--dourado)"] {
    background: #333335 !important;
    color: #e0e0e0 !important;
}

/* Dropdown items */
body.tema-escuro .dropdown-item {
    color: #e0e0e0 !important;
}

body.tema-escuro .dropdown-item:hover {
    background: #3a3a3b !important;
}

/* Legenda FMEA */
body.tema-escuro div[class*="col-md"] strong {
    color: #e0e0e0 !important;
}

/* Prevenir qualquer texto preto residual */
body.tema-escuro .card-premium,
body.tema-escuro .card-premium * {
    color: inherit;
}

body.tema-escuro .card-premium {
    color: #e0e0e0;
}

/* Badges coloridos - manter visiveis */
body.tema-escuro span[style*="background:"][style*="color:#fff"] {
    text-shadow: none !important;
}

/* ── Tema Escuro - Dashboard e Alertas v4 ────────────────────────────── */

/* Alertas Bootstrap */
body.tema-escuro .alert-danger {
    background: #3d1a1a !important;
    border-color: #dc3545 !important;
    color: #f5c6cb !important;
}

body.tema-escuro .alert-warning {
    background: #3d3520 !important;
    border-color: #ffc107 !important;
    color: #ffeeba !important;
}

body.tema-escuro .alert-info {
    background: #1a2a3d !important;
    border-color: #17a2b8 !important;
    color: #bee5eb !important;
}

body.tema-escuro .alert-success {
    background: #1a3d20 !important;
    border-color: #28a745 !important;
    color: #c3e6cb !important;
}

body.tema-escuro .alert strong {
    color: inherit !important;
}

body.tema-escuro .alert span {
    color: inherit !important;
}

/* Dashboard textos */
body.tema-escuro p[style*="color:#666"],
body.tema-escuro small[style*="color:#999"],
body.tema-escuro span[style*="color:#666"],
body.tema-escuro div[style*="color:#666"] {
    color: #aaa !important;
}

/* Riscos heatmap - eixos */
body.tema-escuro div[style*="color:var(--text-axis"] {
    color: #ccc !important;
}

/* ── Admin Mobile Responsivo ─────────────────────────────────────────── */
@media (max-width: 768px) {
    /* Tabelas admin scrollaveis */
    .table-premium {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* KPI cards em 2 colunas no mobile */
    .kpi-card {
        padding: 12px !important;
    }

    .kpi-card .kpi-value {
        font-size: 1.2rem !important;
    }

    .kpi-card .kpi-label {
        font-size: 0.7rem !important;
    }

    /* Cards admin */
    .card-premium .card-body {
        padding: 10px !important;
    }

    .card-premium .card-header {
        padding: 8px 12px !important;
        font-size: 0.85rem !important;
    }

    /* Botoes admin empilhados */
    .page-header {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .page-header .d-flex {
        flex-wrap: wrap !important;
        gap: 5px !important;
    }

    /* Formularios admin */
    .col-md-3, .col-md-4, .col-md-6 {
        padding-left: 6px !important;
        padding-right: 6px !important;
    }

    /* Topbar compacta */
    .topbar {
        padding: 8px 10px !important;
    }

    .topbar-title {
        font-size: 0.85rem !important;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Tabela premium - celulas compactas */
    .table-premium th,
    .table-premium td {
        padding: 6px 8px !important;
        font-size: 0.78rem !important;
        white-space: nowrap;
    }

    /* Esconder colunas menos importantes */
    .table-premium .d-none-mobile {
        display: none !important;
    }

    /* Badges e botoes menores */
    .table-premium .btn-sm {
        padding: 2px 6px !important;
        font-size: 0.7rem !important;
    }

    .table-premium .badge {
        font-size: 0.65rem !important;
        padding: 2px 5px !important;
    }

    /* Main content sem padding excessivo */
    .main-content {
        padding: 10px !important;
    }

    /* Modo reuniao esconder no mobile */
    #btn-modo-reuniao {
        display: none !important;
    }
}

@media (max-width: 480px) {
    /* Extra small - KPIs em coluna unica */
    .row .col-md-3 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    .topbar-title {
        max-width: 100px;
    }

    /* Tabela ainda mais compacta */
    .table-premium th,
    .table-premium td {
        padding: 4px 6px !important;
        font-size: 0.72rem !important;
    }
}
