/* =============================================
   7NEXUS V2 - Stylesheet Principal
   Design: Clean, light sidebar, profissional
   Inspirado em CRM Pro / SaaS moderno
   ============================================= */

:root {
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 68px;
    --topbar-height: 56px;

    /* Cores principais */
    --nx-primary: #2563eb;
    --nx-primary-hover: #1d4ed8;
    --nx-primary-light: #eff6ff;
    --nx-primary-50: #dbeafe;
    --nx-success: #16a34a;
    --nx-success-light: #dcfce7;
    --nx-danger: #dc2626;
    --nx-danger-light: #fef2f2;
    --nx-warning: #f59e0b;
    --nx-warning-light: #fffbeb;
    --nx-info: #0891b2;
    --nx-info-light: #ecfeff;
    --nx-orange: #ea580c;
    --nx-orange-light: #fff7ed;
    --nx-purple: #7c3aed;
    --nx-purple-light: #f5f3ff;
    --nx-receipt: rgb(207, 128, 0);
    --nx-receipt-light: rgba(207, 128, 0, 0.14);

    /* Sidebar (light) */
    --nx-sidebar-bg: #ffffff;
    --nx-sidebar-border: #e5e7eb;
    --nx-sidebar-text: #6b7280;
    --nx-sidebar-text-hover: #111827;
    --nx-sidebar-active-bg: var(--nx-primary-light);
    --nx-sidebar-active-text: var(--nx-primary);
    --nx-sidebar-active-border: var(--nx-primary);
    --nx-sidebar-group: #9ca3af;

    /* Layout */
    --nx-body-bg: #f9fafb;
    --nx-card-bg: #ffffff;
    --nx-border: #e5e7eb;
    --nx-border-light: #f3f4f6;
    --nx-text: #374151;
    --nx-text-muted: #6b7280;
    --nx-text-dark: #111827;
    --nx-text-light: #9ca3af;

    /* Sistema */
    --nx-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --nx-radius: 8px;
    --nx-radius-lg: 10px;
    --nx-radius-xl: 12px;
    --nx-shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --nx-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
    --nx-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    --nx-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --nx-transition: 0.2s ease;

    /* Tokens auxiliares (genéricos, neutros) */
    --nx-input-bg: #ffffff;
    --nx-input-disabled-bg: #f3f4f6;
    --nx-overlay-bg: rgba(15, 23, 42, 0.45);
    --nx-table-stripe: #f9fafb;
    --nx-table-hover: #eff6ff;
    --nx-code-bg: #f3f4f6;
    --nx-tooltip-bg: #111827;
    --nx-tooltip-text: #f9fafb;
    --nx-modal-bg: #ffffff;
    /* Label → campo em modais / diálogos (SweetAlert, Bootstrap) */
    --nx-modal-label-field-gap: 0.625rem;

    /* Tokens específicos do WhatsApp */
    --nx-whatsapp-chat-bg: #efeae2;
    --nx-whatsapp-recebido: #ffffff;
    --nx-whatsapp-enviado: #d9fdd3;
}

/* =============================================
   TEMA ESCURO — overrides via [data-theme="dark"]
   Mantém os mesmos --nx-* tokens que o restante do
   sistema já consome (não duplica regras CSS).
   ============================================= */
[data-theme="dark"] {
    /* Cores principais — preservar identidade da marca */
    --nx-primary: #3b82f6;
    --nx-primary-hover: #60a5fa;
    --nx-primary-light: rgba(59, 130, 246, 0.18);
    --nx-primary-50:    rgba(59, 130, 246, 0.28);

    --nx-success: #22c55e;
    --nx-success-light: rgba(34, 197, 94, 0.18);
    --nx-danger: #ef4444;
    --nx-danger-light: rgba(239, 68, 68, 0.18);
    --nx-warning: #f59e0b;
    --nx-warning-light: rgba(245, 158, 11, 0.18);
    --nx-info: #06b6d4;
    --nx-info-light: rgba(6, 182, 212, 0.18);
    --nx-orange: #f97316;
    --nx-orange-light: rgba(249, 115, 22, 0.18);
    --nx-purple: #a78bfa;
    --nx-purple-light: rgba(167, 139, 250, 0.18);

    /* Sidebar (dark) */
    --nx-sidebar-bg:           #111827;
    --nx-sidebar-border:       #1f2937;
    --nx-sidebar-text:         #cbd5e1;
    --nx-sidebar-text-hover:   #f8fafc;
    --nx-sidebar-active-bg:    rgba(59, 130, 246, 0.18);
    --nx-sidebar-active-text:  #93c5fd;
    --nx-sidebar-active-border: var(--nx-primary);
    --nx-sidebar-group:        #64748b;

    /* Layout */
    --nx-body-bg:    #0b1220;
    --nx-card-bg:    #111827;
    --nx-modal-bg:   #111827;
    --nx-border:        #1f2937;
    --nx-border-light:  #1a2333;
    --nx-text:        #d1d5db;
    --nx-text-muted:  #9ca3af;
    --nx-text-dark:   #f3f4f6;
    --nx-text-light:  #6b7280;

    /* Tokens auxiliares */
    --nx-input-bg:           #1a2333;
    --nx-input-disabled-bg:  #111827;
    --nx-overlay-bg:         rgba(0, 0, 0, 0.65);
    --nx-table-stripe:       #131c2c;
    --nx-table-hover:        rgba(59, 130, 246, 0.10);
    --nx-code-bg:            #1f2937;
    --nx-tooltip-bg:         #f9fafb;
    --nx-tooltip-text:       #111827;

    /* Sombras suavizadas */
    --nx-shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.40);
    --nx-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.45), 0 1px 2px -1px rgba(0, 0, 0, 0.30);
    --nx-shadow:    0 4px 6px -1px rgba(0, 0, 0, 0.50), 0 2px 4px -2px rgba(0, 0, 0, 0.30);
    --nx-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.55), 0 4px 6px -4px rgba(0, 0, 0, 0.35);

    /* Tokens específicos do WhatsApp */
    --nx-whatsapp-chat-bg:   #0c1622;
    --nx-whatsapp-recebido:  #1a2333;
    --nx-whatsapp-enviado:   #144d35;

    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--nx-font);
    background: var(--nx-body-bg);
    color: var(--nx-text);
    margin: 0;
    font-size: 14px;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =============================================
   SIDEBAR - LIGHT THEME
   ============================================= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--nx-sidebar-bg);
    border-right: 1px solid var(--nx-sidebar-border);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: width var(--nx-transition);
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    min-height: var(--topbar-height);
    border-bottom: 1px solid var(--nx-border-light);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0;
    white-space: nowrap;
    overflow: hidden;
    text-decoration: none;
}

.brand-logo {
    height: 30px;
    width: auto;
    flex-shrink: 0;
    transition: opacity var(--nx-transition);
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--nx-text-light);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--nx-transition);
    flex-shrink: 0;
    font-size: 12px;
}

.sidebar-toggle:hover {
    background: var(--nx-body-bg);
    color: var(--nx-text);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--nx-border) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--nx-border);
    border-radius: 3px;
}

.sidebar-group-title {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--nx-sidebar-group);
    padding: 18px 10px 6px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 10px;
    border-radius: 7px;
    color: var(--nx-sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--nx-transition);
    white-space: nowrap;
    margin-bottom: 1px;
    position: relative;
    border-left: 3px solid transparent;
}

.sidebar-link i {
    font-size: 15px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    color: var(--nx-sidebar-text);
    transition: color var(--nx-transition);
}

.sidebar-link:hover {
    color: var(--nx-sidebar-text-hover);
    background: var(--nx-body-bg);
}

.sidebar-link:hover i {
    color: var(--nx-sidebar-text-hover);
}

.sidebar-link.active {
    background: var(--nx-sidebar-active-bg);
    color: var(--nx-sidebar-active-text);
    border-left-color: var(--nx-sidebar-active-border);
    font-weight: 600;
}

.sidebar-link.active i {
    color: var(--nx-sidebar-active-text);
}

/* Sidebar footer */
.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--nx-border-light);
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--nx-radius);
    transition: background var(--nx-transition);
    cursor: default;
    overflow: hidden;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.sidebar-user-avatar-placeholder {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: var(--nx-primary);
}

.sidebar-user-details {
    min-width: 0;
    flex: 1;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--nx-text-dark);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--nx-text-muted);
    display: block;
}

.sidebar-logout-btn {
    background: none;
    border: none;
    color: var(--nx-text-light);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all var(--nx-transition);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.sidebar-logout-btn:hover {
    color: var(--nx-danger);
    background: var(--nx-danger-light);
}

/* Sidebar WhatsApp Badge */
.sidebar-whatsapp-badge {
    background: var(--nx-danger) !important;
    color: #fff !important;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 5px;
    border-radius: 10px;
    text-align: center;
    margin-left: auto;
    flex-shrink: 0;
    animation: pulseBadge 2s ease-in-out infinite;
}

@keyframes pulseBadge {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

/* Sidebar Collapsed */
.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

.sidebar-collapsed .sidebar-whatsapp-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    font-size: 9px;
    padding: 0 4px;
}

/* WhatsApp Global Notification Toast — compacta */
.whatsapp-notif-toast {
    font-size: 13px !important;
    padding: 8px 12px !important;
    min-width: auto !important;
    max-width: 320px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    border-left: 4px solid #25D366 !important;
}

.whatsapp-notif-toast .swal2-title {
    font-size: 13px !important;
    margin: 0 !important;
    padding: 0 4px !important;
}

.whatsapp-notif-toast .swal2-icon {
    width: 24px !important;
    height: 24px !important;
    margin: 0 8px 0 0 !important;
    border-width: 2px !important;
}

.whatsapp-notif-toast .swal2-icon .swal2-icon-content {
    font-size: 14px !important;
}

.whatsapp-notif-toast .swal2-actions {
    margin: 0 0 0 8px !important;
    padding: 0 !important;
}

.whatsapp-notif-toast .swal2-confirm {
    font-size: 11px !important;
    padding: 4px 12px !important;
    border-radius: 20px !important;
}

.sidebar-collapsed .sidebar-link-text,
.sidebar-collapsed .sidebar-user-details {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-collapsed .sidebar-group-title {
    opacity: 0;
    width: 0;
    height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.sidebar-collapsed .sidebar-header {
    padding: 16px 8px;
    justify-content: center;
}

.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 10px;
    border-left-width: 0;
}

/* Tooltip da sidebar colapsada — agora é um elemento flutuante criado por
   JS (assets/js/app.js → initSidebarTooltips), pois o overflow:hidden do
   .sidebar cortaria pseudo-elementos. As regras abaixo apenas estilizam
   esse elemento (.nx-sidebar-tip). */
.nx-sidebar-tip {
    position: fixed;
    background: var(--nx-tooltip-bg);
    color: var(--nx-tooltip-text);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1;
    z-index: 1080;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
    visibility: hidden;
    font-family: var(--nx-font);
    max-width: 240px;
}

.nx-sidebar-tip.show {
    opacity: 1;
    transform: translateX(0);
    visibility: visible;
    transition-delay: 0s;
}

.nx-sidebar-tip::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-style: solid;
    border-width: 5px 6px 5px 0;
    border-color: transparent var(--nx-tooltip-bg) transparent transparent;
}

/* (regras de pseudo-elemento removidas — substituídas pelo .nx-sidebar-tip via JS) */

/* --- Selects com cadastro relacionado (novo / editar ao lado do label) --- */
.nx-select-rel-label-row {
    margin-bottom: 0.35rem;
    align-items: center;
}
.nx-select-rel-toolbar {
    flex-shrink: 0;
}
.nx-select-rel-toolbar .btn {
    line-height: 1.2;
    min-height: 1.75rem;
    padding-top: 0;
    padding-bottom: 0;
}
[data-theme="dark"] .nx-select-rel-toolbar .btn-outline-primary {
    border-color: var(--nx-primary);
    color: var(--nx-primary);
}
[data-theme="dark"] .nx-select-rel-toolbar .btn-outline-secondary {
    border-color: var(--nx-border);
    color: var(--nx-text-muted);
}

@media (min-width: 992px) {
    /* Mantém apenas o cursor de "pointer" e melhora a área clicável dos
       links quando colapsados. O tooltip propriamente é renderizado por JS. */
    .sidebar-collapsed .sidebar-link[data-tooltip] {
        cursor: pointer;
    }
}

.sidebar-collapsed .sidebar-brand {
    opacity: 0;
    width: 0;
    overflow: hidden;
    pointer-events: none;
}

.sidebar-collapsed .sidebar-header {
    justify-content: center;
}

.sidebar-collapsed .sidebar-nav {
    padding: 8px 6px;
}

.sidebar-collapsed #sidebar-toggle-icon {
    transform: rotate(180deg);
}

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--nx-transition);
    background: var(--nx-body-bg);
}

.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* =============================================
   TOPBAR
   ============================================= */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: var(--topbar-height);
    background: var(--nx-card-bg);
    border-bottom: 1px solid var(--nx-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.topbar-toggle {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--nx-text-muted);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--nx-radius);
}

.topbar-toggle:hover {
    background: var(--nx-body-bg);
}

/* Topbar search bar */
.topbar-search {
    position: relative;
    width: 280px;
}

.topbar-search .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--nx-text-light);
    font-size: 13px;
}

.topbar-search input {
    width: 100%;
    border: 1px solid var(--nx-border);
    border-radius: 20px;
    padding: 7px 14px 7px 36px;
    font-size: 13px;
    background: var(--nx-body-bg);
    color: var(--nx-text);
    transition: all var(--nx-transition);
    font-family: var(--nx-font);
}

.topbar-search input::placeholder {
    color: var(--nx-text-light);
}

.topbar-search input:focus {
    outline: none;
    border-color: var(--nx-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

/* Search dropdown results */
.busca-global-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 6px;
    background: var(--nx-card-bg);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius-xl);
    box-shadow: var(--nx-shadow-lg);
    max-height: 380px;
    overflow-y: auto;
    z-index: 1050;
}

.busca-group-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--nx-text-light);
    padding: 10px 14px 4px;
}

.busca-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    text-decoration: none;
    color: var(--nx-text);
    transition: background var(--nx-transition);
    cursor: pointer;
}

.busca-item:hover {
    background: var(--nx-body-bg);
    color: var(--nx-text-dark);
}

.busca-item-icon {
    width: 20px;
    text-align: center;
    color: var(--nx-text-muted);
    font-size: 14px;
    flex-shrink: 0;
}

.busca-item-title {
    font-size: 13px;
    font-weight: 500;
}

.busca-item-sub {
    font-size: 11px;
    color: var(--nx-text-muted);
}

.busca-vazio {
    padding: 20px 14px;
    text-align: center;
    color: var(--nx-text-muted);
    font-size: 13px;
}

.topbar-btn {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--nx-text-muted);
    position: relative;
    cursor: pointer;
    transition: all var(--nx-transition);
    font-size: 15px;
}

.topbar-btn:hover {
    background: var(--nx-body-bg);
    color: var(--nx-text-dark);
}

.topbar-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    background: var(--nx-danger);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #fff;
}

.topbar-divider {
    width: 1px;
    height: 24px;
    background: var(--nx-border);
    margin: 0 6px;
}

/* =============================================
   TOPBAR USER WIDGET
   ============================================= */
.topbar-user-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--nx-card-bg);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius-lg);
    padding: 5px 10px 5px 5px;
    cursor: pointer;
    transition: background var(--nx-transition), border-color var(--nx-transition), box-shadow var(--nx-transition);
    font-family: var(--nx-font);
    height: 40px;
}

.topbar-user-btn:hover {
    background: var(--nx-body-bg);
    border-color: var(--nx-gray-300, #cbd5e1);
    box-shadow: var(--nx-shadow-xs);
}

.topbar-user-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    border-color: var(--nx-primary);
}

/* Avatar circular com iniciais */
.topbar-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10.5px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--nx-primary) 0%, var(--nx-primary-hover) 100%);
    letter-spacing: 0.3px;
    font-family: var(--nx-font);
}

/* Bloco de texto nome + perfil */
.topbar-user-info-text {
    text-align: left;
    line-height: 1.25;
    min-width: 0;
}

.topbar-user-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--nx-text-dark);
    display: block;
    white-space: nowrap;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--nx-font);
}

.topbar-user-role {
    font-size: 10.5px;
    color: var(--nx-text-muted);
    display: block;
    white-space: nowrap;
    font-family: var(--nx-font);
}

/* Ícone de chevron indicativo de dropdown */
.topbar-settings-icon {
    font-size: 11px;
    color: var(--nx-text-light);
    transition: color var(--nx-transition), transform var(--nx-transition);
    margin-left: 1px;
    flex-shrink: 0;
}

.topbar-user-btn:hover .topbar-settings-icon {
    color: var(--nx-text-muted);
}

.topbar-user-btn[aria-expanded="true"] .topbar-settings-icon {
    transform: rotate(180deg);
    color: var(--nx-primary);
}

/* Dropdown do usuário — padrão visual 7Nexus */
.dropdown-user-menu {
    min-width: 240px;
    border: 1px solid var(--nx-border) !important;
    border-radius: var(--nx-radius-xl) !important;
    box-shadow: var(--nx-shadow-lg) !important;
    padding: 6px !important;
    margin-top: 6px !important;
    font-family: var(--nx-font);
    background: var(--nx-card-bg);
}

/* Header do dropdown com identidade do usuário */
.dropdown-user-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px 12px;
    border-bottom: 1px solid var(--nx-border-light);
    margin-bottom: 4px;
}

.dropdown-user-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--nx-primary) 0%, var(--nx-primary-hover) 100%);
    letter-spacing: 0.3px;
    font-family: var(--nx-font);
}

.dropdown-user-header-info {
    min-width: 0;
    flex: 1;
}

.dropdown-user-header-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--nx-text-dark);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--nx-font);
}

.dropdown-user-header-meta {
    font-size: 11px;
    color: var(--nx-text-muted);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--nx-font);
    margin-top: 1px;
}

/* Itens do dropdown do usuário */
.dropdown-user-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--nx-text);
    border-radius: var(--nx-radius);
    transition: background var(--nx-transition), color var(--nx-transition);
    font-family: var(--nx-font);
    text-decoration: none;
    line-height: 1;
}

.dropdown-user-menu .dropdown-item:hover {
    background: var(--nx-body-bg);
    color: var(--nx-text-dark);
}

.dropdown-user-menu .dropdown-item:active {
    background: var(--nx-primary-light);
    color: var(--nx-primary);
}

.dropdown-user-menu .dropdown-item .item-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    background: var(--nx-body-bg);
    color: var(--nx-text-muted);
    transition: background var(--nx-transition), color var(--nx-transition);
}

.dropdown-user-menu .dropdown-item:hover .item-icon {
    background: var(--nx-primary-light);
    color: var(--nx-primary);
}

/* Item de sair — estado de perigo */
.dropdown-user-menu .dropdown-item.item-danger {
    color: var(--nx-text-muted);
}

.dropdown-user-menu .dropdown-item.item-danger:hover {
    background: var(--nx-danger-light);
    color: var(--nx-danger);
}

.dropdown-user-menu .dropdown-item.item-danger:hover .item-icon {
    background: var(--nx-danger-light);
    color: var(--nx-danger);
}

.dropdown-user-menu .dropdown-item.item-danger:active {
    background: var(--nx-danger-light);
    color: var(--nx-danger);
}

/* Divider dentro do dropdown */
.dropdown-user-menu .dropdown-divider {
    border-color: var(--nx-border-light);
    margin: 4px 0;
}

.topbar-add-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--nx-primary);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: background var(--nx-transition);
}

.topbar-add-btn:hover {
    background: var(--nx-primary-hover);
}

.dropdown-notificacoes {
    width: 360px;
    border-radius: var(--nx-radius-xl) !important;
}

.dropdown-notificacoes .dropdown-header {
    background: var(--nx-body-bg);
    border-radius: var(--nx-radius-xl) var(--nx-radius-xl) 0 0;
}

.breadcrumb {
    font-size: 13px;
    margin: 0;
}

.breadcrumb-item a {
    color: var(--nx-text-muted);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: var(--nx-primary);
}

.breadcrumb-item.active {
    color: var(--nx-text-dark);
    font-weight: 600;
}

/* =============================================
   CONTENT AREA
   ============================================= */
.content-area {
    padding: 16px 24px;
    min-height: calc(100vh - var(--topbar-height));
}

/* =============================================
   CARDS
   ============================================= */
.card {
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius-xl);
    box-shadow: var(--nx-shadow-xs);
    background: var(--nx-card-bg);
}

.card-header {
    background: var(--nx-card-bg);
    border-bottom: 1px solid var(--nx-border);
    padding: 16px 20px;
    font-weight: 600;
    font-size: 14px;
}

.card-header h1,
.card-header h2,
.card-header h3,
.card-header h4,
.card-header h5,
.card-header h6 {
    font-size: 14px;
    font-weight: 600;
    color: var(--nx-text-dark);
    margin: 0;
    line-height: 1.4;
    font-family: var(--nx-font);
}

.card-body {
    padding: 16px 20px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--nx-border);
    background: var(--nx-card-bg);
    border-radius: 0 0 var(--nx-radius-xl) var(--nx-radius-xl);
}

.hover-lift {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1) !important;
}

.btn-group {
    display: inline-flex;
}

.btn-group .btn {
    border-radius: 0;
    margin: 0;
    border-right-width: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: var(--nx-radius);
    border-bottom-left-radius: var(--nx-radius);
}

.btn-group .btn:last-child {
    border-top-right-radius: var(--nx-radius);
    border-bottom-right-radius: var(--nx-radius);
    border-right-width: 1px;
}

.btn-group-sm .btn {
    font-size: 11px;
    padding: 4px 10px;
}

/* =============================================
   KPI CARDS (Dashboard)
   ============================================= */
.kpi-card {
    background: var(--nx-card-bg);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius-xl);
    padding: 20px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: box-shadow var(--nx-transition);
}

.kpi-card:hover {
    box-shadow: var(--nx-shadow);
}

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.kpi-content,
.kpi-info {
    flex: 1;
}

.kpi-label {
    font-size: 12px;
    color: var(--nx-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
    display: block;
}

.kpi-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--nx-text-dark);
    line-height: 1.1;
    display: block;
}

.kpi-sub {
    font-size: 12px;
    color: var(--nx-text-muted);
    margin-top: 2px;
}

.kpi-trend {
    font-size: 12px;
    font-weight: 600;
}

.kpi-trend.up {
    color: var(--nx-success);
}

.kpi-trend.down {
    color: var(--nx-danger);
}

/* KPI Color Variants */
.kpi-primary .kpi-icon {
    background: var(--nx-primary-light);
    color: var(--nx-primary);
}

.kpi-success .kpi-icon {
    background: var(--nx-success-light);
    color: var(--nx-success);
}

.kpi-warning .kpi-icon {
    background: var(--nx-warning-light);
    color: var(--nx-warning);
}

.kpi-danger .kpi-icon {
    background: var(--nx-danger-light);
    color: var(--nx-danger);
}

.kpi-info .kpi-icon {
    background: var(--nx-info-light);
    color: var(--nx-info);
}

.kpi-purple .kpi-icon {
    background: var(--nx-purple-light);
    color: var(--nx-purple);
}

.kpi-orange .kpi-icon {
    background: var(--nx-orange-light);
    color: var(--nx-orange);
}

/* Module KPIs Grid */
.module-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.module-kpis.kpis-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* KPI Skeleton Loading */
.kpi-loading {
    display: inline-block;
    width: 72px;
    height: 22px;
    background: linear-gradient(90deg, var(--nx-border) 25%, #e8edf2 50%, var(--nx-border) 75%);
    background-size: 200% 100%;
    animation: kpi-shimmer 1.4s infinite;
    border-radius: 4px;
    vertical-align: middle;
}

@keyframes kpi-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

@media (max-width: 1200px) {
    .module-kpis {
        grid-template-columns: repeat(2, 1fr);
    }

    .module-kpis.kpis-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767px) {

    .module-kpis,
    .module-kpis.kpis-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {

    .module-kpis,
    .module-kpis.kpis-3 {
        grid-template-columns: 1fr;
    }
}

/* =============================================
   MODULE TABLE (view.php auto-generator)
   ============================================= */
.module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.module-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--nx-text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.module-title i {
    color: var(--nx-primary);
    font-size: 20px;
}

.module-title .module-count {
    font-size: 14px;
    font-weight: 500;
    color: var(--nx-text-muted);
}

.module-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.module-toolbar {
    background: var(--nx-card-bg);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius-xl) var(--nx-radius-xl) 0 0;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.module-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 200px;
    min-width: 180px;
    position: relative;
}

.module-search .form-control {
    border-radius: 20px;
    font-size: 13px;
    border: 1px solid var(--nx-border);
    padding: 8px 14px 8px 36px;
    background: var(--nx-body-bg);
}

.module-search .form-control:focus {
    background: #fff;
    border-color: var(--nx-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.module-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--nx-text-light);
    font-size: 13px;
}

.module-filters {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.module-filters .form-select {
    font-size: 13px;
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius);
    padding: 7px 30px 7px 10px;
    width: 155px;
    flex: 0 0 155px;
    color: var(--nx-text);
}

.batch-actions {
    display: none;
    gap: 8px;
    align-items: center;
    padding: 8px 16px;
    background: var(--nx-primary-light);
    border-left: 1px solid var(--nx-border);
    border-right: 1px solid var(--nx-border);
}

.batch-actions.show {
    display: flex;
}

.batch-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--nx-primary);
}

.module-table-wrapper {
    background: var(--nx-card-bg);
    border: 1px solid var(--nx-border);
    border-top: none;
    overflow-x: auto;
}

.module-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.module-table thead th {
    background: var(--nx-body-bg);
    padding: 10px 16px;
    font-weight: 600;
    color: var(--nx-text-muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--nx-border);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.module-table thead th:hover {
    color: var(--nx-text-dark);
}

.module-table thead th .sort-icon {
    margin-left: 4px;
    font-size: 10px;
    opacity: 0.4;
}

.module-table thead th.sorted .sort-icon {
    opacity: 1;
    color: var(--nx-primary);
}

.module-table tbody tr {
    border-bottom: 1px solid var(--nx-border-light);
    transition: background var(--nx-transition);
}

.module-table tbody tr:hover {
    background: var(--nx-body-bg);
}

.module-table tbody tr.selected {
    background: var(--nx-primary-light);
}

.module-table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    color: var(--nx-text);
}

.module-table .col-check {
    width: 40px;
    text-align: center;
}

.module-table .col-check input[type="checkbox"] {
    cursor: pointer;
}

.module-table .col-actions {
    width: 1%;
    white-space: nowrap;
    text-align: center;
}

.module-table .col-actions .btn-action,
.module-table td.col-actions .btn-action {
    margin-right: 4px;
}

.module-table .col-actions .btn-action:last-child {
    margin-right: 0;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.status-ativo,
.status-pago,
.status-concluido,
.status-confirmado {
    background: var(--nx-success-light);
    color: var(--nx-success);
}

.status-inativo,
.status-cancelado,
.status-falta {
    background: var(--nx-danger-light);
    color: var(--nx-danger);
}

.status-pendente,
.status-agendado,
.status-aguardando {
    background: var(--nx-warning-light);
    color: #92400e;
}

.status-parcial,
.status-em_atendimento,
.status-rascunho {
    background: var(--nx-info-light);
    color: var(--nx-info);
}

.status-atrasado {
    background: var(--nx-danger-light);
    color: var(--nx-danger);
}

.status-reagendado {
    background: var(--nx-purple-light);
    color: var(--nx-purple);
}

.status-resolvido {
    background: var(--nx-success-light);
    color: var(--nx-success);
}

.status-suspenso {
    background: var(--nx-orange-light);
    color: var(--nx-orange);
}

/* Tipo Financeiro — badge específico de categorias */
.status-financeiro {
    background: #fef3c7;
    color: #92400e;
}

.status-procedimento {
    background: #ede9fe;
    color: #5b21b6;
}

.status-documento {
    background: #e0f2fe;
    color: #0369a1;
}

.status-outro {
    background: #f3f4f6;
    color: #374151;
}

/* Icon Picker — seletor de ícones Bootstrap Icons em modal */
.btn-icone-picker {
    border-color: var(--nx-border) !important;
    transition: all .15s;
}

.btn-icone-picker:hover {
    border-color: var(--nx-primary) !important;
    background: var(--nx-primary-light) !important;
}

.icon-picker-grid {
    max-height: 180px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius);
    background: var(--nx-bg);
}

.icone-selecionado-preview {
    min-width: 40px;
    text-align: center;
    color: var(--nx-primary);
}

/* Paginação */
.module-pagination {
    background: var(--nx-card-bg);
    border: 1px solid var(--nx-border);
    border-top: none;
    border-radius: 0 0 var(--nx-radius-xl) var(--nx-radius-xl);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.module-pagination-info {
    font-size: 13px;
    color: var(--nx-text-muted);
}

.module-pagination-pages {
    display: flex;
    gap: 4px;
}

.module-pagination-pages .page-btn {
    min-width: 32px;
    height: 32px;
    border: 1px solid var(--nx-border);
    border-radius: 6px;
    background: var(--nx-card-bg);
    color: var(--nx-text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--nx-transition);
}

.module-pagination-pages .page-btn:hover {
    border-color: var(--nx-primary);
    color: var(--nx-primary);
}

.module-pagination-pages .page-btn.active {
    background: var(--nx-primary);
    color: #fff;
    border-color: var(--nx-primary);
}

.module-pagination-pages .page-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.module-pagination-perpage {
    display: flex;
    align-items: center;
    gap: 8px;
}

.module-pagination-perpage select {
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--nx-border);
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--nx-radius);
    padding: 8px 16px;
    transition: all var(--nx-transition);
    font-family: var(--nx-font);
    cursor: pointer;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-xs {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 5px;
}

.btn-primary {
    background: var(--nx-primary);
    border-color: var(--nx-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--nx-primary-hover);
    border-color: var(--nx-primary-hover);
}

.btn-outline-secondary {
    border: 1px solid var(--nx-border);
    color: var(--nx-text-muted);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--nx-body-bg);
    color: var(--nx-text);
    border-color: var(--nx-border);
}

.btn-action {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    vertical-align: middle;
    transition: all var(--nx-transition);
}

.btn-action i {
    font-size: 14px;
    line-height: 1;
}

.btn-action-view {
    background: var(--nx-info-light);
    color: var(--nx-info);
}

.btn-action-edit {
    background: var(--nx-primary-light);
    color: var(--nx-primary);
}

.btn-action-delete {
    background: var(--nx-danger-light);
    color: var(--nx-danger);
}

.btn-action-receipt {
    background: var(--nx-receipt-light);
    color: var(--nx-receipt);
}

.btn-action-payment {
    background: var(--nx-success-light);
    color: var(--nx-success);
}

.btn-action-extra {
    background: var(--nx-warning-light);
    color: var(--nx-warning);
}

.btn-action:hover {
    opacity: 0.85;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* Modal — seleção de colunas da tabela */
.nx-colunas-lista {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px 16px;
    max-height: 320px;
    overflow-y: auto;
    padding: 4px 2px;
}

.nx-colunas-lista .form-check {
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius);
    background: var(--nx-card-bg);
    transition: border-color var(--nx-transition), background var(--nx-transition);
}

.nx-colunas-lista .form-check:has(input:checked) {
    border-color: var(--nx-primary);
    background: var(--nx-primary-light);
}

.nx-colunas-lista .form-check-label {
    cursor: pointer;
    font-size: 13px;
    color: var(--nx-text);
}

.module-table th.nx-col-hidden,
.module-table td.nx-col-hidden {
    display: none !important;
}

/* =============================================
   FORMS (Modais)
   ============================================= */
/* =============================================
   MODAL SYSTEM — COMPLETO (sem Bootstrap)
   ============================================= */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1050;
    overflow: hidden;
    outline: 0;
}

.modal.show {
    display: block;
}

.modal-dialog {
    position: relative;
    width: auto;
    max-width: 500px;
    margin: 1.25rem auto;
    max-height: calc(100vh - 2.5rem);
    pointer-events: none;
    transition: transform 0.2s ease-out;
    transform: translateY(-20px);
    display: flex;
    flex-direction: column;
}

.modal.show .modal-dialog {
    transform: translateY(0);
}

/* Modais: corpo rolável quando o conteúdo excede a altura da tela */
.modal-dialog {
    max-height: calc(100vh - 2.5rem);
    display: flex;
    flex-direction: column;
    margin-top: 1.25rem;
    margin-bottom: 1.25rem;
}

.modal-dialog-scrollable {
    max-height: calc(100vh - 2.5rem);
}

.modal-content {
    max-height: calc(100vh - 2.5rem);
    overflow: hidden;
}

.modal-content > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.modal-dialog-scrollable .modal-content,
.modal-content {
    display: flex;
    flex-direction: column;
}

.modal-body {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.modal-header,
.modal-footer {
    flex-shrink: 0;
}

/* Modal sizes */
.modal-sm {
    max-width: 380px;
}

.modal-md {
    max-width: 540px;
}

.modal-lg {
    max-width: 780px;
}

.modal-xl {
    max-width: 1080px;
}

/* Modal content */
.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: all;
    background: var(--nx-card-bg);
    border: none;
    border-radius: var(--nx-radius-xl);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.14), 0 8px 16px rgba(0, 0, 0, 0.08);
    outline: 0;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--nx-border-light);
    background: var(--nx-card-bg);
    border-radius: var(--nx-radius-xl) var(--nx-radius-xl) 0 0;
    flex-shrink: 0;
}

/* Remove colored modal headers (padrão branco) */
.modal-header[class*="bg-"],
.modal-header.bg-success,
.modal-header.bg-primary,
.modal-header.bg-danger,
.modal-header.bg-warning,
.modal-header.bg-info,
.modal-header.bg-dark {
    background: var(--nx-card-bg) !important;
    color: var(--nx-text-dark) !important;
}

.modal-header .modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--nx-text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.modal-header .modal-title i {
    color: var(--nx-primary);
    font-size: 15px;
}

.modal-body {
    padding: 24px;
    background: var(--nx-card-bg);
}

.modal-body.p-0 {
    padding: 0;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 24px;
    border-top: 1px solid var(--nx-border-light);
    background: var(--nx-card-bg);
    border-radius: 0 0 var(--nx-radius-xl) var(--nx-radius-xl);
    flex-shrink: 0;
}

/* Modal Backdrop */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.15s linear;
}

.modal-backdrop.show {
    opacity: 1;
}

/* Prevent body scroll when modal open */
body.modal-open {
    overflow: hidden;
}

/* Static backdrop shake */
@keyframes modalShake {

    0%,
    100% {
        transform: translateY(0);
    }

    25% {
        transform: translateY(-4px);
    }

    75% {
        transform: translateY(4px);
    }
}

.modal-static .modal-dialog {
    animation: modalShake 0.25s ease;
}

/* Btn-close replacement */
.btn-close {
    background: none;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--nx-text-muted);
    font-size: 16px;
    transition: all var(--nx-transition);
    padding: 0;
    flex-shrink: 0;
}

.btn-close::before {
    content: '\00d7';
    font-size: 20px;
    line-height: 1;
}

.btn-close:hover {
    background: var(--nx-body-bg);
    color: var(--nx-text-dark);
}

.btn-close-white {
    color: var(--nx-text-muted);
}

/* Responsive modals */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 16px;
        max-width: calc(100% - 32px);
    }

    .modal-dialog.modal-xl,
    .modal-dialog.modal-lg {
        max-width: calc(100% - 32px);
    }

    .modal-header {
        padding: 14px 16px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        padding: 12px 16px;
    }
}

/* Modal centered */
.modal-dialog-centered {
    min-height: calc(100% - 80px);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    margin: 40px auto;
}

.modal-dialog-centered .modal-content {
    width: 100%;
    flex-shrink: 0;
}

/* =============================================
   MODAL — REDESIGN: ÍCONE, TABS PILL, SEÇÕES
   ============================================= */

/* Faixa de destaque no topo */
.modal-content {
    border-top: 3px solid var(--nx-primary) !important;
}

/* Caixa de título com ícone */
.modal-title-box {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

/* Badge ícone do modal */
.modal-title-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--nx-radius);
    background: var(--nx-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.modal-title-icon i {
    color: var(--nx-primary);
    font-size: 14px;
}

.modal-title-icon.icon-success {
    background: var(--nx-success-light);
}

.modal-title-icon.icon-success i {
    color: var(--nx-success);
}

.modal-title-icon.icon-warning {
    background: var(--nx-warning-light);
}

.modal-title-icon.icon-warning i {
    color: var(--nx-warning);
}

.modal-title-icon.icon-danger {
    background: var(--nx-danger-light);
}

.modal-title-icon.icon-danger i {
    color: var(--nx-danger);
}

.modal-title-icon.icon-info {
    background: var(--nx-info-light);
}

.modal-title-icon.icon-info i {
    color: var(--nx-info);
}

.modal-title-box .modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--nx-text-dark);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-title-box .modal-subtitle {
    font-size: 11.5px;
    color: var(--nx-text-muted);
    font-weight: 400;
    display: block;
    margin-top: 1px;
}

/* ── Tabs pill dentro do modal-body ── */
.modal-body .nav-tabs {
    background: var(--nx-body-bg);
    border-bottom: none;
    border-radius: var(--nx-radius);
    padding: 6px 8px;
    gap: 2px;
    margin-bottom: 20px;
}

.modal-body .nav-tabs .nav-link {
    border: none;
    border-radius: 6px;
    padding: 12px 14px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--nx-text-muted);
    background: transparent;
    margin-bottom: 0;
    border-bottom: none;
    cursor: pointer;
}

.modal-body .nav-tabs .nav-link:hover {
    background: var(--nx-card-bg);
    color: var(--nx-text-dark);
}

.modal-body .nav-tabs .nav-link.active {
    background: var(--nx-card-bg);
    color: var(--nx-primary);
    font-weight: 600;
    border-bottom: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Tabs no padrão modal-body.p-0 (nav fora do body padding) */
.modal-body.p-0 .nav-tabs {
    border-radius: 0;
    margin-bottom: 0;
    border-bottom: 1px solid var(--nx-border);
    padding: 8px 16px 0;
    background: var(--nx-body-bg);
}

.modal-body.p-0 .nav-tabs .nav-link.active {
    background: var(--nx-card-bg);
    box-shadow: none;
    border-bottom: 2px solid var(--nx-primary);
}

.modal-body.p-0 .tab-content {
    padding: 20px !important;
}

/* ── Título de seção dentro do form ── */
.form-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--nx-text-muted);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--nx-border-light);
    margin-bottom: 16px;
    margin-top: 4px;
}

.form-section-title i {
    color: var(--nx-primary);
    font-size: 11px;
}

/* ── Footer do modal levemente destacado ── */
.modal-footer {
    background: var(--nx-body-bg) !important;
}

.modal-footer .btn-secondary {
    margin-right: auto;
}

/* form-text helper */
.form-text {
    font-size: 11.5px;
    color: var(--nx-text-light);
    margin-top: 4px;
    display: block;
}

/* display:block: <label> padrão é inline — sem isso margin-bottom quase não afasta o campo */
.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--nx-text-muted);
    margin-bottom: 0.5rem;
}

/* Modais / Swal: mesmo padrão dos selects com toolbar (vence utilitários mb-1 etc. no label) */
.modal .modal-body label.form-label:not(.mb-0),
.swal2-popup label.form-label:not(.mb-0) {
    display: block !important;
    margin-bottom: var(--nx-modal-label-field-gap, 0.625rem) !important;
}

.modal .modal-body .nx-select-rel-label-row,
.swal2-popup .nx-select-rel-label-row {
    margin-bottom: var(--nx-modal-label-field-gap, 0.625rem) !important;
}

.modal .modal-body .nx-select-rel-label-row label.form-label.mb-0,
.swal2-popup .nx-select-rel-label-row label.form-label.mb-0 {
    margin-bottom: 0 !important;
}

/*
 * Mesma linha (.row): colunas com select+toolbar e input simples —
 * reserva altura fixa na faixa do label para alinhar os campos abaixo.
 */
.modal .modal-body .row > [class*="col-"],
.swal2-popup .row > [class*="col-"] {
    display: flex;
    flex-direction: column;
}

.modal .modal-body .row > [class*="col-"] > label.form-label:not(.mb-0),
.modal .modal-body .row > [class*="col-"] > .nx-select-rel-label-row,
.swal2-popup .row > [class*="col-"] > label.form-label:not(.mb-0),
.swal2-popup .row > [class*="col-"] > .nx-select-rel-label-row {
    min-height: 1.75rem;
    margin-bottom: var(--nx-modal-label-field-gap, 0.625rem) !important;
    flex-shrink: 0;
}

.modal .modal-body .row > [class*="col-"] > label.form-label:not(.mb-0),
.swal2-popup .row > [class*="col-"] > label.form-label:not(.mb-0) {
    display: flex !important;
    align-items: center;
}

.form-control,
.form-select {
    font-size: 13px;
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius);
    padding: 9px 12px;
    color: var(--nx-text);
    transition: border-color var(--nx-transition), box-shadow var(--nx-transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--nx-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.form-control::placeholder {
    color: var(--nx-text-light);
}

.form-check-input:checked {
    background-color: var(--nx-primary);
    border-color: var(--nx-primary);
}

/* =============================================
   SELECT2 — TEMA CUSTOMIZADO (sem Bootstrap)
   ============================================= */
.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--single {
    background: var(--nx-card-bg);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius);
    height: 38px;
    display: flex;
    align-items: center;
    transition: border-color var(--nx-transition), box-shadow var(--nx-transition);
    font-family: var(--nx-font);
    position: relative;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--nx-text);
    font-size: 13px;
    line-height: 38px;
    padding: 0 52px 0 12px;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--nx-text-light);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
    right: 8px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--nx-text-muted) transparent transparent transparent;
    border-width: 5px 4px 0 4px;
}

.select2-container--default .select2-selection--single .select2-selection__clear {
    position: absolute;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--nx-text-muted);
    font-size: 16px;
    font-weight: 400;
    line-height: 1;
    padding: 2px 4px;
    margin: 0;
    z-index: 1;
    border-radius: 3px;
    transition: color var(--nx-transition);
}

.select2-container--default .select2-selection--single .select2-selection__clear:hover {
    color: var(--nx-danger);
    background: var(--nx-danger-light);
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent var(--nx-text-muted) transparent;
    border-width: 0 4px 5px 4px;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--nx-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
    outline: none;
}

/* Select2 — Multiple */
.select2-container--default .select2-selection--multiple {
    background: var(--nx-card-bg);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius);
    min-height: 38px;
    padding: 2px 6px;
    font-family: var(--nx-font);
    transition: border-color var(--nx-transition), box-shadow var(--nx-transition);
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: var(--nx-primary-light);
    border: 1px solid var(--nx-primary-50);
    border-radius: 4px;
    color: var(--nx-primary);
    font-size: 12px;
    font-weight: 500;
    padding: 2px 6px;
    margin: 2px 3px 2px 0;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: var(--nx-primary);
    font-size: 14px;
    margin-right: 4px;
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: var(--nx-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

/* Select2 — Dropdown */
.select2-dropdown {
    background: var(--nx-card-bg);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius);
    box-shadow: var(--nx-shadow-lg);
    font-family: var(--nx-font);
    font-size: 13px;
    z-index: 9999;
}

.select2-search--dropdown {
    padding: 8px;
    border-bottom: 1px solid var(--nx-border-light);
}

.select2-search--dropdown .select2-search__field {
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius);
    padding: 7px 12px;
    font-size: 13px;
    font-family: var(--nx-font);
    width: 100%;
    color: var(--nx-text);
    background: var(--nx-body-bg);
}

.select2-search--dropdown .select2-search__field:focus {
    border-color: var(--nx-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
    outline: none;
}

.select2-results__options {
    max-height: 240px;
    overflow-y: auto;
    padding: 4px;
}

.select2-results__option {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 5px;
    color: var(--nx-text);
    cursor: pointer;
    transition: background var(--nx-transition);
}

.select2-results__option--highlighted,
.select2-results__option--highlighted[aria-selected] {
    background: var(--nx-primary);
    color: #fff;
}

.select2-results__option[aria-selected="true"] {
    background: var(--nx-primary-light);
    color: var(--nx-primary);
    font-weight: 600;
}

.select2-results__option--disabled {
    color: var(--nx-text-light);
    cursor: not-allowed;
}

.select2-results__message {
    padding: 8px 12px;
    color: var(--nx-text-muted);
    font-size: 13px;
}

/* Select2 — Estado disabled */
.select2-container--default.select2-container--disabled .select2-selection--single,
.select2-container--default.select2-container--disabled .select2-selection--multiple {
    background: var(--nx-body-bg) !important;
    cursor: not-allowed;
    opacity: 0.7;
}

.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__arrow b {
    border-color: var(--nx-text-light) transparent transparent transparent;
}

/* Select2 — Variante SM (para form-select-sm) */
select.form-select-sm.select2-hidden-accessible+.select2-container--default .select2-selection--single {
    height: 32px;
}

select.form-select-sm.select2-hidden-accessible+.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 30px;
    font-size: 12px;
    padding: 0 28px 0 10px;
}

select.form-select-sm.select2-hidden-accessible+.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 30px;
}

/* Select2 — Em .module-filters (toolbar): largura auto/compacta */
.module-filters .select2-container {
    min-width: 120px;
    max-width: 220px;
    width: auto !important;
}

/* Select2 — Em .module-actions e .module-header (cabeçalho do módulo): compacto */
.module-actions .select2-container,
.module-header .select2-container {
    min-width: 140px;
    max-width: 230px;
    width: auto !important;
}

/* Select2 — Em diario-header-acoes (filtros inline do diário) */
.diario-header-acoes .select2-container {
    min-width: 130px;
    max-width: 180px;
    width: auto !important;
}

/* Select2 — Dentro de input-group (flex) */
.input-group .select2-container {
    flex: 1 1 auto;
    min-width: 0;
    width: auto !important;
}

.input-group .select2-container .select2-selection--single {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-right: none !important;
}

/* =============================================
   NAV TABS
   ============================================= */
.nav-tabs-custom {
    border-bottom: 2px solid var(--nx-border-light);
}

.nav-tabs-custom .nav-link {
    border: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--nx-text-muted);
    padding: 10px 16px;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--nx-transition);
    cursor: pointer;
}

.nav-tabs-custom .nav-link:hover {
    color: var(--nx-text-dark);
}

.nav-tabs-custom .nav-link.active {
    color: var(--nx-primary);
    border-bottom-color: var(--nx-primary);
    background: transparent;
}

/* =============================================
   CONFIGURAÇÕES - ABAS
   ============================================= */
.config-tabs {
    background: var(--nx-card-bg);
    border: 1px solid var(--nx-border);
    border-bottom: none;
    border-radius: var(--nx-radius-xl) var(--nx-radius-xl) 0 0;
    padding: 0 8px;
    flex-wrap: wrap;
    gap: 0;
}

.config-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 13px;
    font-weight: 500;
    color: var(--nx-text-muted);
    padding: 14px 18px;
    margin-bottom: -1px;
    transition: all var(--nx-transition);
    white-space: nowrap;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
}

.config-tabs .nav-link i {
    font-size: 14px;
}

.config-tabs .nav-link:hover {
    color: var(--nx-text-dark);
    background: transparent;
}

.config-tabs .nav-link.active {
    color: var(--nx-primary);
    border-bottom-color: var(--nx-primary);
    background: transparent;
    font-weight: 600;
}

.config-tab-content {
    background: var(--nx-card-bg);
    border: 1px solid var(--nx-border);
    border-top: 1px solid var(--nx-border);
    border-radius: 0 0 var(--nx-radius-xl) var(--nx-radius-xl);
}

.config-pane-body {
    padding: 28px 32px;
}

.config-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.config-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--nx-text-dark);
    margin-bottom: 4px;
}

.config-section-desc {
    font-size: 13px;
    color: var(--nx-text-muted);
    margin-bottom: 0;
}

.config-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    background: var(--nx-danger-light);
    color: var(--nx-danger);
}

.config-status-badge.status-ok {
    background: var(--nx-success-light);
    color: var(--nx-success);
}

/* Cabeçalho interno das abas de módulo dentro de Configurações */
.config-aba-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--nx-border-light);
    margin-bottom: 0;
}

.config-aba-titulo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
    color: var(--nx-text-dark);
}

.config-aba-titulo i {
    font-size: 16px;
    color: var(--nx-primary);
}

.config-aba-acoes {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Nas abas de módulo, remover padding do config-pane-body para que o conteúdo
   do módulo (KPIs, toolbar, tabela) use seu próprio espaçamento */
.tab-pane .config-aba-header ~ .module-kpis,
.tab-pane .config-aba-header ~ .module-toolbar,
.tab-pane .config-aba-header ~ .batch-actions,
.tab-pane .config-aba-header ~ .module-table-wrapper,
.tab-pane .config-aba-header ~ .module-pagination {
    margin-left: 24px;
    margin-right: 24px;
}

.tab-pane .config-aba-header ~ .module-kpis {
    margin-top: 20px;
}

.tab-pane .config-aba-header ~ .module-pagination {
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .config-pane-body {
        padding: 20px 16px;
    }

    .config-tabs .nav-link {
        padding: 12px 12px;
        font-size: 12px;
    }
}

/* =============================================
   NOTIFICATION ITEMS
   ============================================= */
.notif-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background var(--nx-transition);
    border-bottom: 1px solid var(--nx-border-light);
}

.notif-item:hover {
    background: var(--nx-body-bg);
}

.notif-item.unread {
    background: var(--nx-primary-light);
}

.notif-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.notif-content {
    flex: 1;
    min-width: 0;
}

.notif-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--nx-text-dark);
}

.notif-msg {
    font-size: 12px;
    color: var(--nx-text-muted);
    margin-top: 2px;
}

.notif-time {
    font-size: 11px;
    color: var(--nx-text-light);
    margin-top: 4px;
}

/* =============================================
   UTILITY CLASSES
   ============================================= */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer {
    cursor: pointer;
}

.min-w-0 {
    min-width: 0;
}

.fw-600 {
    font-weight: 600;
}

/* Tables inside cards (Dashboard, custom modules) */
.card .table {
    font-size: 13px;
    margin-bottom: 0;
}

.card .table thead th {
    background: var(--nx-body-bg);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--nx-text-muted);
    padding: 10px 16px;
    border-bottom: 1px solid var(--nx-border);
    white-space: nowrap;
}

.card .table tbody td {
    padding: 10px 16px;
    vertical-align: middle;
    color: var(--nx-text);
    border-bottom: 1px solid var(--nx-border-light);
}

.card .table tbody tr:hover {
    background: var(--nx-body-bg);
}

.card .table tbody tr:last-child td {
    border-bottom: none;
}

/* =============================================
   SCROLLBAR GLOBAL
   ============================================= */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* =============================================
   OVERLAY MOBILE
   ============================================= */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1035;
    backdrop-filter: blur(2px);
}

/* =============================================
   WHATSAPP MODULE
   ============================================= */
.bg-chat-pattern {
    background-color: #f0f2f5;
}

.balao-recebido {
    background-color: #ffffff;
    border-radius: 0 12px 12px 12px;
    padding: 10px 15px;
    max-width: 75%;
    box-shadow: var(--nx-shadow-xs);
    align-self: flex-start;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 100px;
}

.balao-enviado {
    background-color: #d9fdd3;
    border-radius: 12px 0 12px 12px;
    padding: 10px 15px;
    max-width: 75%;
    box-shadow: var(--nx-shadow-xs);
    align-self: flex-end;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 100px;
}

.balao-diario {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 12px;
    padding: 12px 15px;
    max-width: 85%;
    margin: 10px auto;
    box-shadow: var(--nx-shadow-xs);
    word-wrap: break-word;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: none;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: var(--nx-shadow-lg);
    }

    .sidebar.mobile-open~.sidebar-overlay {
        display: block;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .content-area {
        padding: 16px;
    }

    .topbar {
        padding: 0 16px;
    }

    .topbar-search {
        width: 200px;
    }

    .module-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .module-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .module-search {
        max-width: 100%;
    }

    .topbar-user-btn {
        padding: 5px 8px 5px 5px;
        gap: 7px;
    }
}

@media (max-width: 575.98px) {
    .content-area {
        padding: 12px;
    }

    .kpi-card {
        padding: 16px;
    }

    .kpi-value {
        font-size: 22px;
    }

    .topbar-search {
        display: none;
    }

    .topbar-user-btn {
        padding: 5px 7px 5px 5px;
        gap: 6px;
    }

    .topbar-settings-icon {
        display: none;
    }
}

/* =============================================
   PRINT
   ============================================= */
@media print {

    .sidebar,
    .topbar,
    .sidebar-overlay {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .content-area {
        padding: 0 !important;
    }
}

/* =============================================
   FULLCALENDAR THEME OVERRIDES (Agenda)
   ============================================= */
.fc {
    font-family: var(--nx-font);
    font-size: 13px;
}

.fc .fc-toolbar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--nx-text-dark);
}

.fc .fc-button {
    background: var(--nx-card-bg);
    border: 1px solid var(--nx-border);
    color: var(--nx-text);
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--nx-radius) !important;
    text-transform: none;
    box-shadow: none !important;
}

.fc .fc-button:hover {
    background: var(--nx-body-bg);
    border-color: var(--nx-border);
    color: var(--nx-text-dark);
}

.fc .fc-button-active,
.fc .fc-button:active {
    background: var(--nx-primary) !important;
    border-color: var(--nx-primary) !important;
    color: #fff !important;
}

.fc .fc-button-group>.fc-button {
    border-radius: 0 !important;
}

.fc .fc-button-group>.fc-button:first-child {
    border-radius: var(--nx-radius) 0 0 var(--nx-radius) !important;
}

.fc .fc-button-group>.fc-button:last-child {
    border-radius: 0 var(--nx-radius) var(--nx-radius) 0 !important;
}

.fc .fc-today-button {
    border-radius: var(--nx-radius) !important;
}

.fc .fc-today-button:disabled {
    opacity: 0.4;
}

.fc th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--nx-text-muted);
    padding: 10px 0;
}

.fc td,
.fc th {
    border-color: var(--nx-border-light);
}

.fc .fc-scrollgrid {
    border-color: var(--nx-border);
    border-radius: var(--nx-radius-xl);
    overflow: hidden;
}

.fc .fc-day-today {
    background: var(--nx-primary-light) !important;
}

.fc .fc-daygrid-day-number,
.fc .fc-col-header-cell-cushion {
    color: var(--nx-text);
    text-decoration: none;
    font-weight: 500;
}

.fc .fc-event {
    border: none;
    border-radius: 5px;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.fc .fc-timegrid-slot {
    height: 40px;
}

.fc .fc-timegrid-slot-label-cushion {
    font-size: 11px;
    color: var(--nx-text-muted);
}

.fc .fc-now-indicator-line {
    border-color: var(--nx-danger);
}

.fc .fc-now-indicator-arrow {
    border-color: var(--nx-danger);
}

.fc .fc-list-event:hover td {
    background: var(--nx-body-bg);
}

.fc .fc-list-day-cushion {
    background: var(--nx-body-bg);
    font-weight: 600;
    font-size: 13px;
}

/* =============================================
   NAV TABS — PADRÃO (substituto Bootstrap)
   ============================================= */
.nav {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    margin: 0;
    list-style: none;
}

.nav-tabs {
    border-bottom: 1px solid var(--nx-border);
    gap: 2px;
}

.nav-tabs .nav-item {
    margin: 0;
}

.nav-tabs .nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--nx-text-muted);
    text-decoration: none;
    border: 1px solid transparent;
    border-bottom: 2px solid transparent;
    border-radius: var(--nx-radius) var(--nx-radius) 0 0;
    margin-bottom: -1px;
    transition: all var(--nx-transition);
    cursor: pointer;
    background: transparent;
    font-family: var(--nx-font);
}

.nav-tabs .nav-link:hover {
    color: var(--nx-text-dark);
    background: var(--nx-body-bg);
}

.nav-tabs .nav-link.active {
    color: var(--nx-primary);
    border-color: var(--nx-border) var(--nx-border) var(--nx-card-bg);
    border-bottom: 2px solid var(--nx-primary);
    background: var(--nx-card-bg);
    font-weight: 600;
}

.tab-content {}

.tab-pane {
    display: none;
    animation: none;
}

.tab-pane.active {
    display: block;
}

.tab-pane.fade {
    opacity: 0;
    transition: opacity 0.15s linear;
}

.tab-pane.fade.show {
    opacity: 1;
}

.tab-pane.fade.active.show {
    display: block;
}

/* =============================================
   DROPDOWN — PADRÃO (substituto Bootstrap)
   ============================================= */
.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 1000;
    min-width: 180px;
    background: var(--nx-card-bg);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius-xl);
    box-shadow: var(--nx-shadow-lg);
    padding: 4px;
    list-style: none;
    margin: 0;
    font-size: 13px;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu-end {
    right: 0;
    left: auto;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--nx-text);
    text-decoration: none;
    border-radius: 6px;
    transition: background var(--nx-transition), color var(--nx-transition);
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: var(--nx-font);
}

.dropdown-item:hover {
    background: var(--nx-body-bg);
    color: var(--nx-text-dark);
}

.dropdown-item:active {
    background: var(--nx-primary-light);
    color: var(--nx-primary);
}

.dropdown-item.active {
    background: var(--nx-primary-light);
    color: var(--nx-primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--nx-border-light);
    margin: 4px 0;
    border: none;
}

.dropdown-header {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--nx-text-light);
}

/* =============================================
   BREADCRUMB
   ============================================= */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 0;
    margin: 0;
    list-style: none;
    font-size: 13px;
    gap: 4px;
}

.breadcrumb-item+.breadcrumb-item::before {
    content: '/';
    color: var(--nx-text-light);
    margin-right: 4px;
}

.breadcrumb-item a {
    color: var(--nx-text-muted);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: var(--nx-primary);
}

.breadcrumb-item.active {
    color: var(--nx-text-dark);
    font-weight: 600;
}

/* =============================================
   BADGE
   ============================================= */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    line-height: 1.4;
    white-space: nowrap;
}

.rounded-pill {
    border-radius: 50rem !important;
}

.badge.bg-primary {
    background: var(--nx-primary);
    color: #fff;
}

.badge.bg-success {
    background: var(--nx-success);
    color: #fff;
}

.badge.bg-danger {
    background: var(--nx-danger);
    color: #fff;
}

.badge.bg-warning {
    background: var(--nx-warning);
    color: #fff;
}

.badge.bg-info {
    background: var(--nx-info);
    color: #fff;
}

.badge.bg-secondary {
    background: #6b7280;
    color: #fff;
}

.badge.bg-dark {
    background: #111827;
    color: #fff;
}

.badge.bg-light {
    background: var(--nx-body-bg);
    color: var(--nx-text);
}

/* =============================================
   ALERT
   ============================================= */
.alert {
    padding: 12px 16px;
    border-radius: var(--nx-radius);
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-info {
    background: var(--nx-info-light);
    color: var(--nx-info);
    border: 1px solid #a5f3fc;
}

.alert-success {
    background: var(--nx-success-light);
    color: var(--nx-success);
    border: 1px solid #bbf7d0;
}

.alert-danger {
    background: var(--nx-danger-light);
    color: var(--nx-danger);
    border: 1px solid #fecaca;
}

.alert-warning {
    background: var(--nx-warning-light);
    color: #92400e;
    border: 1px solid #fde68a;
}

/* =============================================
   BUTTON VARIANTS (completos)
   ============================================= */
.btn-secondary {
    background: #fff;
    border: 1px solid var(--nx-border);
    color: var(--nx-text-muted);
    font-family: var(--nx-font);
}

.btn-secondary:hover {
    background: var(--nx-body-bg);
    color: var(--nx-text);
    border-color: var(--nx-border);
}

.btn-success {
    background: var(--nx-success);
    border: 1px solid var(--nx-success);
    color: #fff;
    font-family: var(--nx-font);
}

.btn-success:hover {
    background: #15803d;
    border-color: #15803d;
}

.btn-danger {
    background: var(--nx-danger);
    border: 1px solid var(--nx-danger);
    color: #fff;
    font-family: var(--nx-font);
}

.btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.btn-warning {
    background: var(--nx-warning);
    border: 1px solid var(--nx-warning);
    color: #fff;
    font-family: var(--nx-font);
}

.btn-warning:hover {
    background: #d97706;
    border-color: #d97706;
}

.btn-info {
    background: var(--nx-info);
    border: 1px solid var(--nx-info);
    color: #fff;
    font-family: var(--nx-font);
}

.btn-info:hover {
    background: #0e7490;
    border-color: #0e7490;
}

.btn-light {
    background: var(--nx-body-bg);
    border: 1px solid var(--nx-border);
    color: var(--nx-text);
    font-family: var(--nx-font);
}

.btn-light:hover {
    background: var(--nx-border-light);
}

.btn-link {
    background: none;
    border: none;
    color: var(--nx-primary);
    text-decoration: underline;
    padding: 0;
    font-family: var(--nx-font);
    cursor: pointer;
}

.btn-link:hover {
    color: var(--nx-primary-hover);
}

.btn-outline-primary {
    background: transparent;
    border: 1px solid var(--nx-primary);
    color: var(--nx-primary);
    font-family: var(--nx-font);
}

.btn-outline-primary:hover {
    background: var(--nx-primary);
    color: #fff;
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid var(--nx-danger);
    color: var(--nx-danger);
    font-family: var(--nx-font);
}

.btn-outline-danger:hover {
    background: var(--nx-danger);
    color: #fff;
}

.btn-outline-success {
    background: transparent;
    border: 1px solid var(--nx-success);
    color: var(--nx-success);
    font-family: var(--nx-font);
}

.btn-outline-success:hover {
    background: var(--nx-success);
    color: #fff;
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* =============================================
   FORM UTILITIES
   ============================================= */
.form-control {
    display: block;
    width: 100%;
    background: var(--nx-card-bg);
    font-family: var(--nx-font);
    line-height: 1.4;
    outline: none;
}

.form-control:disabled,
.form-control[readonly] {
    background: var(--nx-body-bg);
    color: var(--nx-text-muted);
    cursor: not-allowed;
}

.form-select {
    display: block;
    width: 100%;
    background: var(--nx-card-bg);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 32px;
    appearance: none;
    -webkit-appearance: none;
    font-family: var(--nx-font);
    cursor: pointer;
    outline: none;
}

.form-select:disabled {
    background-color: var(--nx-body-bg);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Variantes SM */
.form-control-sm,
.form-select-sm {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: calc(var(--nx-radius) - 2px);
}

.form-select-sm {
    padding-right: 28px;
    background-size: 10px;
    background-position: right 8px center;
}

.form-text {
    display: block;
    margin-top: 4px;
    font-size: 11.5px;
    color: var(--nx-text-muted);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 24px;
    padding: 0;
}

.form-check-input {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--nx-border);
    border-radius: 4px;
    cursor: pointer;
    accent-color: var(--nx-primary);
    flex-shrink: 0;
}

.form-check-input[type="radio"] {
    border-radius: 50%;
}

.form-check-input:checked {
    background-color: var(--nx-primary);
    border-color: var(--nx-primary);
    accent-color: var(--nx-primary);
}

.form-check-label {
    font-size: 13px;
    color: var(--nx-text);
    cursor: pointer;
    line-height: 1.4;
}

.form-control-color {
    width: 40px;
    height: 38px;
    padding: 2px;
    cursor: pointer;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    flex: 1;
    border-radius: var(--nx-radius) 0 0 var(--nx-radius);
}

.input-group .btn {
    border-radius: 0 var(--nx-radius) var(--nx-radius) 0;
    flex-shrink: 0;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--nx-body-bg);
    border: 1px solid var(--nx-border);
    font-size: 13px;
    color: var(--nx-text-muted);
}

.input-group .form-control:not(:last-child) {
    border-right: none;
}

/* =============================================
   GRID SYSTEM (substituto Bootstrap)
   ============================================= */
.container,
.container-fluid {
    width: 100%;
    padding-right: 16px;
    padding-left: 16px;
    margin-right: auto;
    margin-left: auto;
}

.container {
    max-width: 1200px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: calc(-0.5 * var(--nx-gutter, 16px));
    margin-left: calc(-0.5 * var(--nx-gutter, 16px));
}

.row>* {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    padding-right: calc(0.5 * var(--nx-gutter, 16px));
    padding-left: calc(0.5 * var(--nx-gutter, 16px));
    box-sizing: border-box;
}

/* Gap (gutter) utilities */
.g-0 {
    --nx-gutter: 0;
    row-gap: 0;
}

.g-1 {
    --nx-gutter: 4px;
    row-gap: 4px;
}

.g-2 {
    --nx-gutter: 8px;
    row-gap: 8px;
}

.g-3 {
    --nx-gutter: 16px;
    row-gap: 16px;
}

.g-4 {
    --nx-gutter: 24px;
    row-gap: 24px;
}

.g-5 {
    --nx-gutter: 40px;
    row-gap: 40px;
}

.gx-2 {
    --nx-gutter: 8px;
}

.gx-3 {
    --nx-gutter: 16px;
}

.gy-2 {
    row-gap: 8px;
}

.gy-3 {
    row-gap: 16px;
}

/* Base columns */
.col {
    flex: 1 0 0%;
}

.col-1 {
    flex: 0 0 8.333333%;
    max-width: 8.333333%;
}

.col-2 {
    flex: 0 0 16.666667%;
    max-width: 16.666667%;
}

.col-3 {
    flex: 0 0 25%;
    max-width: 25%;
}

.col-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
}

.col-5 {
    flex: 0 0 41.666667%;
    max-width: 41.666667%;
}

.col-6 {
    flex: 0 0 50%;
    max-width: 50%;
}

.col-7 {
    flex: 0 0 58.333333%;
    max-width: 58.333333%;
}

.col-8 {
    flex: 0 0 66.666667%;
    max-width: 66.666667%;
}

.col-9 {
    flex: 0 0 75%;
    max-width: 75%;
}

.col-10 {
    flex: 0 0 83.333333%;
    max-width: 83.333333%;
}

.col-11 {
    flex: 0 0 91.666667%;
    max-width: 91.666667%;
}

.col-12 {
    flex: 0 0 100%;
    max-width: 100%;
}

.col-auto {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
}

/* Small breakpoint (≥576px) */
@media (min-width: 576px) {
    .col-sm-1 {
        flex: 0 0 8.333333%;
        max-width: 8.333333%;
    }

    .col-sm-2 {
        flex: 0 0 16.666667%;
        max-width: 16.666667%;
    }

    .col-sm-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }

    .col-sm-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }

    .col-sm-5 {
        flex: 0 0 41.666667%;
        max-width: 41.666667%;
    }

    .col-sm-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .col-sm-7 {
        flex: 0 0 58.333333%;
        max-width: 58.333333%;
    }

    .col-sm-8 {
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
    }

    .col-sm-9 {
        flex: 0 0 75%;
        max-width: 75%;
    }

    .col-sm-10 {
        flex: 0 0 83.333333%;
        max-width: 83.333333%;
    }

    .col-sm-11 {
        flex: 0 0 91.666667%;
        max-width: 91.666667%;
    }

    .col-sm-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .col-sm-auto {
        flex: 0 0 auto;
        width: auto;
        max-width: none;
    }

    .d-sm-none {
        display: none !important;
    }

    .d-sm-block {
        display: block !important;
    }

    .d-sm-flex {
        display: flex !important;
    }
}

/* Medium breakpoint (≥768px) */
@media (min-width: 768px) {
    .col-md-1 {
        flex: 0 0 8.333333%;
        max-width: 8.333333%;
    }

    .col-md-2 {
        flex: 0 0 16.666667%;
        max-width: 16.666667%;
    }

    .col-md-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }

    .col-md-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }

    .col-md-5 {
        flex: 0 0 41.666667%;
        max-width: 41.666667%;
    }

    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .col-md-7 {
        flex: 0 0 58.333333%;
        max-width: 58.333333%;
    }

    .col-md-8 {
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
    }

    .col-md-9 {
        flex: 0 0 75%;
        max-width: 75%;
    }

    .col-md-10 {
        flex: 0 0 83.333333%;
        max-width: 83.333333%;
    }

    .col-md-11 {
        flex: 0 0 91.666667%;
        max-width: 91.666667%;
    }

    .col-md-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .col-md-auto {
        flex: 0 0 auto;
        width: auto;
        max-width: none;
    }

    .d-md-none {
        display: none !important;
    }

    .d-md-block {
        display: block !important;
    }

    .d-md-flex {
        display: flex !important;
    }

    .d-md-inline-flex {
        display: inline-flex !important;
    }
}

/* Large breakpoint (≥992px) */
@media (min-width: 992px) {
    .col-lg-1 {
        flex: 0 0 8.333333%;
        max-width: 8.333333%;
    }

    .col-lg-2 {
        flex: 0 0 16.666667%;
        max-width: 16.666667%;
    }

    .col-lg-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }

    .col-lg-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }

    .col-lg-5 {
        flex: 0 0 41.666667%;
        max-width: 41.666667%;
    }

    .col-lg-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .col-lg-7 {
        flex: 0 0 58.333333%;
        max-width: 58.333333%;
    }

    .col-lg-8 {
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
    }

    .col-lg-9 {
        flex: 0 0 75%;
        max-width: 75%;
    }

    .col-lg-10 {
        flex: 0 0 83.333333%;
        max-width: 83.333333%;
    }

    .col-lg-11 {
        flex: 0 0 91.666667%;
        max-width: 91.666667%;
    }

    .col-lg-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .col-lg-auto {
        flex: 0 0 auto;
        width: auto;
        max-width: none;
    }

    .d-lg-none {
        display: none !important;
    }

    .d-lg-block {
        display: block !important;
    }

    .d-lg-flex {
        display: flex !important;
    }
}

/* Extra-large breakpoint (≥1200px) */
@media (min-width: 1200px) {
    .col-xl-1 {
        flex: 0 0 8.333333%;
        max-width: 8.333333%;
    }

    .col-xl-2 {
        flex: 0 0 16.666667%;
        max-width: 16.666667%;
    }

    .col-xl-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }

    .col-xl-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }

    .col-xl-5 {
        flex: 0 0 41.666667%;
        max-width: 41.666667%;
    }

    .col-xl-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .col-xl-7 {
        flex: 0 0 58.333333%;
        max-width: 58.333333%;
    }

    .col-xl-8 {
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
    }

    .col-xl-9 {
        flex: 0 0 75%;
        max-width: 75%;
    }

    .col-xl-10 {
        flex: 0 0 83.333333%;
        max-width: 83.333333%;
    }

    .col-xl-11 {
        flex: 0 0 91.666667%;
        max-width: 91.666667%;
    }

    .col-xl-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* =============================================
   UTILITÁRIOS — DISPLAY
   ============================================= */
.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}

.d-inline {
    display: inline !important;
}

.d-inline-block {
    display: inline-block !important;
}

.d-flex {
    display: flex !important;
}

.d-inline-flex {
    display: inline-flex !important;
}

.d-grid {
    display: grid !important;
}

.d-table {
    display: table !important;
}

/* =============================================
   UTILITÁRIOS — FLEX
   ============================================= */
.flex-row {
    flex-direction: row !important;
}

.flex-column {
    flex-direction: column !important;
}

.flex-wrap {
    flex-wrap: wrap !important;
}

.flex-nowrap {
    flex-wrap: nowrap !important;
}

.flex-fill {
    flex: 1 1 auto !important;
}

.flex-grow-1 {
    flex-grow: 1 !important;
}

.flex-shrink-0 {
    flex-shrink: 0 !important;
}

.flex-shrink-1 {
    flex-shrink: 1 !important;
}

.justify-content-start {
    justify-content: flex-start !important;
}

.justify-content-end {
    justify-content: flex-end !important;
}

.justify-content-center {
    justify-content: center !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.justify-content-around {
    justify-content: space-around !important;
}

.justify-content-evenly {
    justify-content: space-evenly !important;
}

.align-items-start {
    align-items: flex-start !important;
}

.align-items-end {
    align-items: flex-end !important;
}

.align-items-center {
    align-items: center !important;
}

.align-items-baseline {
    align-items: baseline !important;
}

.align-items-stretch {
    align-items: stretch !important;
}

.align-self-start {
    align-self: flex-start !important;
}

.align-self-end {
    align-self: flex-end !important;
}

.align-self-center {
    align-self: center !important;
}

.align-self-stretch {
    align-self: stretch !important;
}

.gap-0 {
    gap: 0 !important;
}

.gap-1 {
    gap: 4px !important;
}

.gap-2 {
    gap: 8px !important;
}

.gap-3 {
    gap: 16px !important;
}

.gap-4 {
    gap: 24px !important;
}

.gap-5 {
    gap: 40px !important;
}

/* =============================================
   UTILITÁRIOS — SPACING (margin/padding)
   ============================================= */
/* Margin */
.m-0 {
    margin: 0 !important;
}

.m-1 {
    margin: 4px !important;
}

.m-2 {
    margin: 8px !important;
}

.m-3 {
    margin: 16px !important;
}

.m-4 {
    margin: 24px !important;
}

.m-5 {
    margin: 48px !important;
}

.m-auto {
    margin: auto !important;
}

.mt-0 {
    margin-top: 0 !important;
}

.mt-1 {
    margin-top: 4px !important;
}

.mt-2 {
    margin-top: 8px !important;
}

.mt-3 {
    margin-top: 16px !important;
}

.mt-4 {
    margin-top: 24px !important;
}

.mt-5 {
    margin-top: 48px !important;
}

.mt-auto {
    margin-top: auto !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-1 {
    margin-bottom: 4px !important;
}

.mb-2 {
    margin-bottom: 8px !important;
}

.mb-3 {
    margin-bottom: 16px !important;
}

.mb-4 {
    margin-bottom: 24px !important;
}

.mb-5 {
    margin-bottom: 48px !important;
}

.mb-auto {
    margin-bottom: auto !important;
}

.ms-0 {
    margin-left: 0 !important;
}

.ms-1 {
    margin-left: 4px !important;
}

.ms-2 {
    margin-left: 8px !important;
}

.ms-3 {
    margin-left: 16px !important;
}

.ms-4 {
    margin-left: 24px !important;
}

.ms-5 {
    margin-left: 48px !important;
}

.ms-auto {
    margin-left: auto !important;
}

.me-0 {
    margin-right: 0 !important;
}

.me-1 {
    margin-right: 4px !important;
}

.me-2 {
    margin-right: 8px !important;
}

.me-3 {
    margin-right: 16px !important;
}

.me-4 {
    margin-right: 24px !important;
}

.me-5 {
    margin-right: 48px !important;
}

.me-auto {
    margin-right: auto !important;
}

.mx-0 {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.mx-1 {
    margin-left: 4px !important;
    margin-right: 4px !important;
}

.mx-2 {
    margin-left: 8px !important;
    margin-right: 8px !important;
}

.mx-3 {
    margin-left: 16px !important;
    margin-right: 16px !important;
}

.mx-4 {
    margin-left: 24px !important;
    margin-right: 24px !important;
}

.mx-auto {
    margin-left: auto !important;
    margin-right: auto !important;
}

.my-0 {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.my-1 {
    margin-top: 4px !important;
    margin-bottom: 4px !important;
}

.my-2 {
    margin-top: 8px !important;
    margin-bottom: 8px !important;
}

.my-3 {
    margin-top: 16px !important;
    margin-bottom: 16px !important;
}

.my-4 {
    margin-top: 24px !important;
    margin-bottom: 24px !important;
}

/* Padding */
.p-0 {
    padding: 0 !important;
}

.p-1 {
    padding: 4px !important;
}

.p-2 {
    padding: 8px !important;
}

.p-3 {
    padding: 16px !important;
}

.p-4 {
    padding: 24px !important;
}

.p-5 {
    padding: 48px !important;
}

.pt-0 {
    padding-top: 0 !important;
}

.pt-1 {
    padding-top: 4px !important;
}

.pt-2 {
    padding-top: 8px !important;
}

.pt-3 {
    padding-top: 16px !important;
}

.pt-4 {
    padding-top: 24px !important;
}

.pb-0 {
    padding-bottom: 0 !important;
}

.pb-1 {
    padding-bottom: 4px !important;
}

.pb-2 {
    padding-bottom: 8px !important;
}

.pb-3 {
    padding-bottom: 16px !important;
}

.pb-4 {
    padding-bottom: 24px !important;
}

.ps-0 {
    padding-left: 0 !important;
}

.ps-1 {
    padding-left: 4px !important;
}

.ps-2 {
    padding-left: 8px !important;
}

.ps-3 {
    padding-left: 16px !important;
}

.ps-4 {
    padding-left: 24px !important;
}

.pe-0 {
    padding-right: 0 !important;
}

.pe-1 {
    padding-right: 4px !important;
}

.pe-2 {
    padding-right: 8px !important;
}

.pe-3 {
    padding-right: 16px !important;
}

.pe-4 {
    padding-right: 24px !important;
}

.px-0 {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.px-1 {
    padding-left: 4px !important;
    padding-right: 4px !important;
}

.px-2 {
    padding-left: 8px !important;
    padding-right: 8px !important;
}

.px-3 {
    padding-left: 16px !important;
    padding-right: 16px !important;
}

.px-4 {
    padding-left: 24px !important;
    padding-right: 24px !important;
}

.px-5 {
    padding-left: 40px !important;
    padding-right: 40px !important;
}

.py-0 {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.py-1 {
    padding-top: 4px !important;
    padding-bottom: 4px !important;
}

.py-2 {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
}

.py-3 {
    padding-top: 16px !important;
    padding-bottom: 16px !important;
}

.py-4 {
    padding-top: 24px !important;
    padding-bottom: 24px !important;
}

/* =============================================
   UTILITÁRIOS — TEXT
   ============================================= */
.text-start {
    text-align: left !important;
}

.text-center {
    text-align: center !important;
}

.text-end {
    text-align: right !important;
}

.text-muted {
    color: var(--nx-text-muted) !important;
}

.text-dark {
    color: var(--nx-text-dark) !important;
}

.text-light {
    color: var(--nx-text-light) !important;
}

.text-white {
    color: #fff !important;
}

.text-primary {
    color: var(--nx-primary) !important;
}

.text-success {
    color: var(--nx-success) !important;
}

.text-danger {
    color: var(--nx-danger) !important;
}

.text-warning {
    color: var(--nx-warning) !important;
}

.text-info {
    color: var(--nx-info) !important;
}

.text-uppercase {
    text-transform: uppercase !important;
}

.text-lowercase {
    text-transform: lowercase !important;
}

.text-capitalize {
    text-transform: capitalize !important;
}

.text-decoration-none {
    text-decoration: none !important;
}

.text-decoration-underline {
    text-decoration: underline !important;
}

.text-nowrap {
    white-space: nowrap !important;
}

.text-break {
    word-break: break-word !important;
}

.fw-light {
    font-weight: 300 !important;
}

.fw-normal {
    font-weight: 400 !important;
}

.fw-medium {
    font-weight: 500 !important;
}

.fw-semibold {
    font-weight: 600 !important;
}

.fw-bold {
    font-weight: 700 !important;
}

.fw-bolder {
    font-weight: 800 !important;
}

.fs-1 {
    font-size: 2rem !important;
}

.fs-2 {
    font-size: 1.75rem !important;
}

.fs-3 {
    font-size: 1.5rem !important;
}

.fs-4 {
    font-size: 1.25rem !important;
}

.fs-5 {
    font-size: 1.1rem !important;
}

.fs-6 {
    font-size: 1rem !important;
}

.small {
    font-size: 11.5px !important;
}

.lead {
    font-size: 15px;
    font-weight: 400;
}

.lh-1 {
    line-height: 1 !important;
}

.lh-sm {
    line-height: 1.25 !important;
}

.lh-base {
    line-height: 1.5 !important;
}

/* =============================================
   UTILITÁRIOS — SIZE
   ============================================= */
.w-25 {
    width: 25% !important;
}

.w-50 {
    width: 50% !important;
}

.w-75 {
    width: 75% !important;
}

.w-100 {
    width: 100% !important;
}

.w-auto {
    width: auto !important;
}

.h-25 {
    height: 25% !important;
}

.h-50 {
    height: 50% !important;
}

.h-75 {
    height: 75% !important;
}

.h-100 {
    height: 100% !important;
}

.h-auto {
    height: auto !important;
}

.mw-100 {
    max-width: 100% !important;
}

.mh-100 {
    max-height: 100% !important;
}

/* =============================================
   UTILITÁRIOS — POSITION
   ============================================= */
.position-static {
    position: static !important;
}

.position-relative {
    position: relative !important;
}

.position-absolute {
    position: absolute !important;
}

.position-fixed {
    position: fixed !important;
}

.position-sticky {
    position: sticky !important;
}

.top-0 {
    top: 0 !important;
}

.bottom-0 {
    bottom: 0 !important;
}

.start-0 {
    left: 0 !important;
}

.end-0 {
    right: 0 !important;
}

/* =============================================
   UTILITÁRIOS — OVERFLOW
   ============================================= */
.overflow-auto {
    overflow: auto !important;
}

.overflow-hidden {
    overflow: hidden !important;
}

.overflow-visible {
    overflow: visible !important;
}

.overflow-scroll {
    overflow: scroll !important;
}

/* =============================================
   UTILITÁRIOS — BORDER
   ============================================= */
.border {
    border: 1px solid var(--nx-border) !important;
}

.border-0 {
    border: 0 !important;
}

.border-top {
    border-top: 1px solid var(--nx-border) !important;
}

.border-bottom {
    border-bottom: 1px solid var(--nx-border) !important;
}

.border-start {
    border-left: 1px solid var(--nx-border) !important;
}

.border-end {
    border-right: 1px solid var(--nx-border) !important;
}

.rounded {
    border-radius: var(--nx-radius) !important;
}

.rounded-0 {
    border-radius: 0 !important;
}

.rounded-1 {
    border-radius: 4px !important;
}

.rounded-2 {
    border-radius: var(--nx-radius) !important;
}

.rounded-3 {
    border-radius: var(--nx-radius-lg) !important;
}

.rounded-circle {
    border-radius: 50% !important;
}

/* =============================================
   UTILITÁRIOS — BACKGROUND
   ============================================= */
.bg-primary {
    background-color: var(--nx-primary) !important;
}

.bg-success {
    background-color: var(--nx-success) !important;
}

.bg-danger {
    background-color: var(--nx-danger) !important;
}

.bg-warning {
    background-color: var(--nx-warning) !important;
}

.bg-info {
    background-color: var(--nx-info) !important;
}

.bg-light {
    background-color: var(--nx-body-bg) !important;
}

.bg-dark {
    background-color: #111827 !important;
}

.bg-white {
    background-color: #ffffff !important;
}

.bg-transparent {
    background-color: transparent !important;
}

/* =============================================
   UTILITÁRIOS — SHADOW
   ============================================= */
.shadow-none {
    box-shadow: none !important;
}

.shadow-sm {
    box-shadow: var(--nx-shadow-sm) !important;
}

.shadow {
    box-shadow: var(--nx-shadow) !important;
}

.shadow-lg {
    box-shadow: var(--nx-shadow-lg) !important;
}

/* =============================================
   UTILITÁRIOS — VISIBILITY
   ============================================= */
.visible {
    visibility: visible !important;
}

.invisible {
    visibility: hidden !important;
}

/* =============================================
   UTILITÁRIOS — MISC
   ============================================= */
.opacity-0 {
    opacity: 0 !important;
}

.opacity-25 {
    opacity: 0.25 !important;
}

.opacity-50 {
    opacity: 0.5 !important;
}

.opacity-75 {
    opacity: 0.75 !important;
}

.opacity-100 {
    opacity: 1 !important;
}

.user-select-none {
    user-select: none !important;
}

.pointer-events-none {
    pointer-events: none !important;
}

/* HR */
hr {
    border: none;
    border-top: 1px solid var(--nx-border-light);
    margin: 16px 0;
    opacity: 1;
}

/* Vertical align */
.align-middle {
    vertical-align: middle !important;
}

.align-top {
    vertical-align: top !important;
}

.align-bottom {
    vertical-align: bottom !important;
}

/* Float */
.float-start {
    float: left !important;
}

.float-end {
    float: right !important;
}

.float-none {
    float: none !important;
}

.clearfix::after {
    content: '';
    display: table;
    clear: both;
}

/* Object-fit */
.object-fit-cover {
    object-fit: cover !important;
}

.object-fit-contain {
    object-fit: contain !important;
}

/* Cursor */
.cursor-pointer {
    cursor: pointer !important;
}

.cursor-default {
    cursor: default !important;
}

.cursor-not-allowed {
    cursor: not-allowed !important;
}

/* =============================================
   TABELAS (substituto Bootstrap .table)
   ============================================= */
.table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: collapse;
    font-size: 13px;
}

.table td,
.table th {
    padding: 10px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--nx-border-light);
}

.table thead th {
    background: var(--nx-body-bg);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--nx-text-muted);
    border-bottom: 1px solid var(--nx-border);
    white-space: nowrap;
}

.table tbody tr:hover {
    background: var(--nx-body-bg);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-striped tbody tr:nth-of-type(odd) {
    background: rgba(0, 0, 0, 0.02);
}

.table-bordered td,
.table-bordered th {
    border: 1px solid var(--nx-border);
}

.table-sm td,
.table-sm th {
    padding: 6px 10px;
}

.table-responsive {
    overflow-x: auto;
}

/* =============================================
   LIST GROUP
   ============================================= */
.list-group {
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    list-style: none;
}

.list-group-item {
    padding: 10px 16px;
    border: 1px solid var(--nx-border);
    border-top: none;
    font-size: 13px;
    color: var(--nx-text);
    background: var(--nx-card-bg);
}

.list-group-item:first-child {
    border-top: 1px solid var(--nx-border);
    border-radius: var(--nx-radius) var(--nx-radius) 0 0;
}

.list-group-item:last-child {
    border-radius: 0 0 var(--nx-radius) var(--nx-radius);
}

.list-group-item.active {
    background: var(--nx-primary-light);
    color: var(--nx-primary);
    border-color: var(--nx-primary-50);
    font-weight: 600;
}

.list-group-item-action {
    cursor: pointer;
    transition: background var(--nx-transition);
}

.list-group-item-action:hover {
    background: var(--nx-body-bg);
}

/* =============================================
   PROGRESS
   ============================================= */
.progress {
    height: 6px;
    background: var(--nx-border-light);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--nx-primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-bar.bg-success {
    background: var(--nx-success);
}

.progress-bar.bg-danger {
    background: var(--nx-danger);
}

.progress-bar.bg-warning {
    background: var(--nx-warning);
}

/* =============================================
   NX DROPZONE — Upload com Drag & Drop
   ============================================= */
.nx-dropzone {
    position: relative;
    border: 2px dashed var(--nx-border);
    border-radius: var(--nx-radius-xl);
    padding: 30px 20px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--nx-transition), background var(--nx-transition), box-shadow var(--nx-transition);
    background: var(--nx-body-bg);
    user-select: none;
}

.nx-dropzone:hover {
    border-color: var(--nx-primary);
    background: rgba(37, 99, 235, 0.03);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.06);
}

.nx-dropzone.drag-over {
    border-color: var(--nx-primary);
    background: rgba(37, 99, 235, 0.05);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    border-style: solid;
}

.nx-dropzone.has-file {
    border-color: var(--nx-success);
    background: rgba(34, 197, 94, 0.03);
    border-style: solid;
    padding-bottom: 16px;
}

.nx-dropzone.has-file:hover {
    background: rgba(34, 197, 94, 0.05);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.06);
}

.nx-dropzone-multiple.has-file {
    text-align: left;
    padding: 16px;
}

.nx-dropzone-multiple .nx-dropzone-content {
    text-align: center;
    padding-bottom: 8px;
}

.nx-dropzone-files-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 8px;
}

.nx-dropzone-multiple .nx-dropzone-file-info {
    margin-top: 0;
}

/* Input invisível — cobre toda a área */
.nx-dropzone-input {
    display: none;
}

/* Ícone centralizado */
.nx-dropzone-icon {
    font-size: 34px;
    color: var(--nx-text-light);
    margin-bottom: 10px;
    transition: color var(--nx-transition), transform var(--nx-transition);
    line-height: 1;
}

.nx-dropzone:hover .nx-dropzone-icon,
.nx-dropzone.drag-over .nx-dropzone-icon {
    color: var(--nx-primary);
    transform: scale(1.08);
}

.nx-dropzone.has-file .nx-dropzone-icon {
    font-size: 24px;
    color: var(--nx-success);
}

/* Textos da área */
.nx-dropzone-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--nx-text);
    margin: 0 0 4px;
}

.nx-dropzone-subtitle {
    font-size: 12.5px;
    color: var(--nx-text-muted);
    margin: 0 0 8px;
}

.nx-dropzone-browse {
    color: var(--nx-primary);
    font-weight: 600;
    cursor: pointer;
}

.nx-dropzone-hint {
    font-size: 11px;
    color: var(--nx-text-light);
    margin: 0;
}

/* Card do arquivo selecionado */
.nx-dropzone-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 10px 14px;
    background: var(--nx-card-bg);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius);
    text-align: left;
}

.nx-dropzone-file-icon {
    font-size: 22px;
    color: var(--nx-primary);
    flex-shrink: 0;
}

.nx-dropzone-file-icon.icon-pdf {
    color: #ef4444;
}

.nx-dropzone-file-icon.icon-word {
    color: #2563eb;
}

.nx-dropzone-file-icon.icon-excel {
    color: #16a34a;
}

.nx-dropzone-file-icon.icon-img {
    color: #8b5cf6;
}

.nx-dropzone-filename {
    flex: 1;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--nx-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nx-dropzone-filesize {
    font-size: 11px;
    color: var(--nx-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.nx-dropzone-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--nx-text-light);
    padding: 3px 6px;
    border-radius: 5px;
    transition: all var(--nx-transition);
    font-size: 12px;
    flex-shrink: 0;
    line-height: 1;
}

.nx-dropzone-remove:hover {
    background: var(--nx-danger-light);
    color: var(--nx-danger);
}

/* Variante compacta (foto de perfil, etc.) */
.nx-dropzone-compact {
    padding: 18px 16px 14px;
}

.nx-dropzone-compact .nx-dropzone-icon {
    font-size: 26px;
    margin-bottom: 6px;
}

.nx-dropzone-compact .nx-dropzone-title {
    font-size: 12.5px;
}

.nx-dropzone-compact .nx-dropzone-subtitle {
    font-size: 12px;
    margin-bottom: 4px;
}

/* Estado drag-over: texto de destaque */
.nx-dropzone.drag-over .nx-dropzone-title::after {
    content: ' — solte aqui!';
    color: var(--nx-primary);
}

/* =============================================
   ANEXOS DO PACIENTE — Lista na aba do modal
   ============================================= */
.nx-anexos-paciente-wrap {
    margin-top: 1.25rem;
    padding-top: 1.125rem;
    border-top: 1px solid var(--nx-border-light);
}

.nx-anexos-paciente-wrap:empty {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.nx-anexos-paciente-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--nx-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.75rem;
}

.nx-anexos-paciente-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.nx-anexos-paciente-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1rem;
    margin: 0;
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius-lg);
    background: var(--nx-card-bg);
    transition: border-color var(--nx-transition), box-shadow var(--nx-transition);
}

.nx-anexos-paciente-item:hover {
    border-color: var(--nx-primary-50, rgba(37, 99, 235, 0.25));
    box-shadow: var(--nx-shadow-sm);
}

.nx-anexos-paciente-thumb {
    width: 2.625rem;
    height: 2.625rem;
    object-fit: cover;
    border-radius: 0.375rem;
    display: block;
}

.nx-anexos-paciente-icon {
    flex-shrink: 0;
    width: 2.625rem;
    height: 2.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--nx-radius);
    background: var(--nx-body-bg);
    font-size: 1.35rem;
    line-height: 1;
}

.nx-anexos-paciente-body {
    flex: 1;
    min-width: 0;
}

.nx-anexos-paciente-name {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--nx-text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
    line-height: 1.35;
}

a.nx-anexos-paciente-name:hover {
    color: var(--nx-primary);
    text-decoration: underline;
}

.nx-anexos-paciente-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem 0.5rem;
    font-size: 0.75rem;
    color: var(--nx-text-muted);
    line-height: 1.4;
}

.nx-anexos-paciente-meta .badge {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.2em 0.5em;
}

.nx-anexos-paciente-meta-sep {
    opacity: 0.45;
    user-select: none;
}

.nx-anexos-paciente-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-left: 0.25rem;
}

.nx-anexos-paciente-actions .btn {
    width: 2rem;
    height: 2rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--nx-radius);
}

.nx-anexos-paciente-empty {
    margin: 0;
    padding: 0.875rem 0.5rem;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--nx-text-muted);
}

#tab-anexos .nx-anexos-paciente-empty {
    margin-top: 0.25rem;
}

[data-theme="dark"] .nx-anexos-paciente-item {
    background: var(--nx-card-bg);
    border-color: var(--nx-border);
}

[data-theme="dark"] .nx-anexos-paciente-icon {
    background: rgba(255, 255, 255, 0.05);
}

/* =============================================
   AVATAR UPLOADER (Meu Perfil)
   ============================================= */
.perfil-avatar-uploader {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.perfil-avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--nx-primary-light);
    border: 3px solid var(--nx-card-bg);
    box-shadow: 0 0 0 1px var(--nx-border), var(--nx-shadow-sm);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.perfil-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.perfil-avatar-iniciais {
    font-size: 42px;
    font-weight: 700;
    color: var(--nx-primary);
}

.perfil-avatar-actions {
    flex: 1;
    min-width: 280px;
    max-width: 480px;
}

.perfil-avatar-dropzone {
    padding: 18px 16px;
}

.perfil-avatar-dropzone .nx-dropzone-icon {
    font-size: 26px;
    margin-bottom: 6px;
}

.perfil-avatar-dropzone .nx-dropzone-title {
    font-size: 13px;
    margin-bottom: 2px;
}

.perfil-avatar-dropzone .nx-dropzone-subtitle {
    font-size: 12px;
    margin-bottom: 4px;
}

@media (max-width: 575.98px) {
    .perfil-avatar-uploader {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .perfil-avatar-actions {
        width: 100%;
        max-width: 100%;
    }
}

/* Avatar com foto no topbar (substitui as iniciais quando há foto) */
.topbar-user-avatar {
    overflow: hidden;
    background-size: cover;
    background-position: center;
}

.topbar-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dropdown-user-header-avatar {
    overflow: hidden;
}

.dropdown-user-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =============================================
   TOOLTIP VISUAL (CSS-only via title)
   ============================================= */
[data-bs-toggle="tooltip"] {
    cursor: pointer;
}

/* =============================================
   MODAL FULLSCREEN
   ============================================= */
.modal-fullscreen {
    width: 100vw;
    max-width: none;
    height: 100%;
    margin: 0;
}

.modal-fullscreen .modal-content {
    height: 100%;
    border: 0;
    border-radius: 0;
}

.modal-fullscreen .modal-body {
    overflow-y: auto;
}

/* =============================================
   CONTAINER FLUID
   ============================================= */
.container-fluid {
    width: 100%;
    padding-right: 16px;
    padding-left: 16px;
    margin-right: auto;
    margin-left: auto;
}

.container {
    width: 100%;
    max-width: 1200px;
    padding-right: 16px;
    padding-left: 16px;
    margin-right: auto;
    margin-left: auto;
}

/* =============================================
   SPINNER
   ============================================= */
@keyframes nx-spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: text-bottom;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: nx-spin 0.75s linear infinite;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
}

.spinner-grow {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: text-bottom;
    background-color: currentColor;
    border-radius: 50%;
    opacity: 0;
    animation: nx-spinner-grow 0.75s linear infinite;
}

.spinner-grow-sm {
    width: 1rem;
    height: 1rem;
}

@keyframes nx-spinner-grow {
    0% {
        transform: scale(0);
    }

    50% {
        opacity: 1;
        transform: none;
    }
}

/* =============================================
   OFFCANVAS
   ============================================= */
.offcanvas {
    position: fixed;
    bottom: 0;
    z-index: 1045;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    visibility: hidden;
    background-color: var(--nx-card-bg);
    outline: 0;
    transition: transform 0.3s ease-in-out;
}

.offcanvas.show {
    visibility: visible;
}

.offcanvas-end {
    top: 0;
    right: 0;
    width: 400px;
    border-left: 1px solid var(--nx-border);
    transform: translateX(100%);
}

.offcanvas-start {
    top: 0;
    left: 0;
    width: 400px;
    border-right: 1px solid var(--nx-border);
    transform: translateX(-100%);
}

.offcanvas-top {
    top: 0;
    right: 0;
    left: 0;
    height: auto;
    max-height: 100%;
    border-bottom: 1px solid var(--nx-border);
    transform: translateY(-100%);
}

.offcanvas-bottom {
    right: 0;
    left: 0;
    height: auto;
    max-height: 75%;
    border-top: 1px solid var(--nx-border);
    transform: translateY(100%);
}

.offcanvas-end.show,
.offcanvas-start.show,
.offcanvas-top.show,
.offcanvas-bottom.show {
    transform: none;
}

.offcanvas-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
}

.offcanvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    flex-shrink: 0;
}

.offcanvas-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    line-height: 1.5;
    color: var(--nx-text-dark);
}

.offcanvas-body {
    flex-grow: 1;
    padding: 16px;
    overflow-y: auto;
}

/* =============================================
   BG-OPACITY (combinações)
   ============================================= */
.bg-primary.bg-opacity-10 {
    background-color: rgba(37, 99, 235, 0.1) !important;
}

.bg-success.bg-opacity-10 {
    background-color: rgba(22, 163, 74, 0.1) !important;
}

.bg-danger.bg-opacity-10 {
    background-color: rgba(220, 38, 38, 0.1) !important;
}

.bg-warning.bg-opacity-10 {
    background-color: rgba(245, 158, 11, 0.1) !important;
}

.bg-info.bg-opacity-10 {
    background-color: rgba(8, 145, 178, 0.1) !important;
}

.bg-secondary.bg-opacity-10 {
    background-color: rgba(107, 114, 128, 0.1) !important;
}

.bg-primary.bg-opacity-25 {
    background-color: rgba(37, 99, 235, 0.25) !important;
}

.bg-success.bg-opacity-25 {
    background-color: rgba(22, 163, 74, 0.25) !important;
}

.bg-danger.bg-opacity-25 {
    background-color: rgba(220, 38, 38, 0.25) !important;
}

.bg-warning.bg-opacity-25 {
    background-color: rgba(245, 158, 11, 0.25) !important;
}

.bg-info.bg-opacity-25 {
    background-color: rgba(8, 145, 178, 0.25) !important;
}

.bg-primary.bg-opacity-50 {
    background-color: rgba(37, 99, 235, 0.5) !important;
}

.bg-success.bg-opacity-50 {
    background-color: rgba(22, 163, 74, 0.5) !important;
}

.bg-danger.bg-opacity-50 {
    background-color: rgba(220, 38, 38, 0.5) !important;
}

.bg-warning.bg-opacity-50 {
    background-color: rgba(245, 158, 11, 0.5) !important;
}

.bg-info.bg-opacity-50 {
    background-color: rgba(8, 145, 178, 0.5) !important;
}

/* =============================================
   BORDER-OPACITY (combinações)
   ============================================= */
.border-primary.border-opacity-25 {
    border-color: rgba(37, 99, 235, 0.25) !important;
}

.border-success.border-opacity-25 {
    border-color: rgba(22, 163, 74, 0.25) !important;
}

.border-danger.border-opacity-25 {
    border-color: rgba(220, 38, 38, 0.25) !important;
}

.border-warning.border-opacity-25 {
    border-color: rgba(245, 158, 11, 0.25) !important;
}

.border-info.border-opacity-25 {
    border-color: rgba(8, 145, 178, 0.25) !important;
}

.border-primary.border-opacity-50 {
    border-color: rgba(37, 99, 235, 0.5) !important;
}

.border-success.border-opacity-50 {
    border-color: rgba(22, 163, 74, 0.5) !important;
}

.border-danger.border-opacity-50 {
    border-color: rgba(220, 38, 38, 0.5) !important;
}

.border-warning.border-opacity-50 {
    border-color: rgba(245, 158, 11, 0.5) !important;
}

/* =============================================
   Z-INDEX UTILITIES
   ============================================= */
.z-0 {
    z-index: 0 !important;
}

.z-1 {
    z-index: 1 !important;
}

.z-2 {
    z-index: 2 !important;
}

.z-3 {
    z-index: 3 !important;
}

/* =============================================
   CONSTRUTOR DE FORMULÁRIOS
   ============================================= */

/* Cards da lista de formulários */
.nx-form-card {
    background: var(--nx-card-bg);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius-xl);
    box-shadow: var(--nx-shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: box-shadow var(--nx-transition), transform var(--nx-transition);
    border-left: 4px solid var(--nx-primary);
}

.nx-form-card:hover {
    box-shadow: var(--nx-shadow-lg);
    transform: translateY(-2px);
}

.nx-form-card--inactive {
    border-left-color: var(--nx-border);
    opacity: .85;
}

.nx-form-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 0;
}

.nx-form-card__icon-wrap {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--nx-primary-light);
    color: var(--nx-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.nx-form-card__icon-wrap--inactive {
    background: var(--nx-border-light);
    color: var(--nx-text-muted);
}

.nx-form-card__badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .3px;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
}

.nx-form-card__badge--active {
    background: var(--nx-success-light);
    color: var(--nx-success);
}

.nx-form-card__badge--inactive {
    background: var(--nx-border-light);
    color: var(--nx-text-muted);
}

.nx-form-card__badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
}

.nx-form-card__body {
    padding: 12px 16px 8px;
    flex: 1;
}

.nx-form-card__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--nx-text-dark);
    margin: 0 0 6px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nx-form-card__desc {
    font-size: 12.5px;
    color: var(--nx-text-muted);
    margin: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 38px;
}

.nx-form-card__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 16px;
    border-top: 1px solid var(--nx-border-light);
    border-bottom: 1px solid var(--nx-border-light);
    background: var(--nx-body-bg);
}

.nx-form-card__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--nx-text-muted);
}

.nx-form-card__meta-item i {
    font-size: 11px;
}

.nx-form-card__meta-date {
    margin-left: auto;
}

.nx-form-card__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
}

.nx-form-card__btn-primary {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--nx-primary);
    background: var(--nx-primary-light);
    border: 1px solid var(--nx-primary-50);
    border-radius: var(--nx-radius);
    cursor: pointer;
    transition: background var(--nx-transition), color var(--nx-transition);
}

.nx-form-card__btn-primary:hover {
    background: var(--nx-primary);
    color: #fff;
    border-color: var(--nx-primary);
}

.nx-form-card__btn-secondary-group {
    display: flex;
    gap: 6px;
}

.nx-form-card__btn-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--nx-radius);
    border: 1px solid var(--nx-border);
    background: var(--nx-card-bg);
    color: var(--nx-text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--nx-transition);
}

.nx-form-card__btn-icon:hover {
    background: var(--nx-body-bg);
    color: var(--nx-text-dark);
    border-color: var(--nx-text-light);
}

.nx-form-card__btn-icon--danger:hover {
    background: var(--nx-danger-light);
    color: var(--nx-danger);
    border-color: var(--nx-danger);
}

/* Estado vazio */
.nx-empty-state {
    text-align: center;
    padding: 64px 24px;
    background: var(--nx-card-bg);
    border-radius: var(--nx-radius-xl);
    border: 2px dashed var(--nx-border);
}

.nx-empty-state__icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--nx-primary-light);
    color: var(--nx-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 20px;
    opacity: .8;
}

.nx-empty-state__title {
    font-size: 18px;
    font-weight: 700;
    color: var(--nx-text-dark);
    margin: 0 0 8px;
}

.nx-empty-state__desc {
    font-size: 14px;
    color: var(--nx-text-muted);
    max-width: 400px;
    margin: 0 auto 24px;
}

/* Layout interno do modal do construtor — rodapé fixo, área central com scroll */
#modalConstrutor .modal-content.nx-modal-construtor {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 2.5rem);
    overflow: hidden;
}

#modalConstrutor .modal-footer {
    flex-shrink: 0;
}

#modalConstrutor .modal-body.nx-construtor-body {
    overflow: hidden;
}

.nx-construtor-body {
    flex: 1 1 auto;
    min-height: 0;
    background: var(--nx-card-bg);
    overflow: hidden;
}

.nx-construtor-paleta {
    width: 280px;
    flex-shrink: 0;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--nx-body-bg);
    border-right: 1px solid var(--nx-border);
}

.nx-construtor-canvas-wrap {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--nx-body-bg);
}

.nx-construtor-canvas {
    min-height: 280px;
    background: var(--nx-card-bg);
    border: 2px dashed var(--nx-border);
    border-radius: var(--nx-radius);
    padding: 16px;
}

.nx-construtor-props {
    width: 300px;
    flex-shrink: 0;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--nx-card-bg);
    border-left: 1px solid var(--nx-border);
}

@media (max-width: 991.98px) {
    #modalConstrutor .nx-construtor-body {
        flex-direction: column;
    }

    .nx-construtor-paleta,
    .nx-construtor-props {
        width: 100%;
        max-height: 40vh;
        border-right: none;
        border-left: none;
        border-bottom: 1px solid var(--nx-border);
    }

    .nx-construtor-props {
        border-top: 1px solid var(--nx-border);
        border-bottom: none;
    }
}

/* Paleta de campos (barra lateral do editor) */
.campo-paleta {
    cursor: grab;
    transition: all 0.2s;
    font-size: 13px;
    background: var(--nx-card-bg);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius);
    padding: 8px 10px;
    color: var(--nx-text);
    box-shadow: var(--nx-shadow-sm);
}

.campo-paleta:hover {
    background: var(--nx-primary-light);
    border-color: var(--nx-primary);
    color: var(--nx-text-dark);
}

.campo-paleta:active {
    cursor: grabbing;
}

/* Canvas do editor */
.campo-canvas {
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--nx-card-bg);
    color: var(--nx-text);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.campo-canvas:hover {
    border-color: var(--nx-primary);
    box-shadow: 0 2px 8px var(--nx-primary-light);
}

.campo-canvas.selecionado {
    border-color: var(--nx-primary);
    background-color: var(--nx-primary-light);
}

.campo-canvas .campo-acoes {
    position: absolute;
    top: 8px;
    right: 8px;
    display: none;
    gap: 4px;
}

.campo-canvas:hover .campo-acoes {
    display: flex;
}

.campo-canvas .campo-acoes button {
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 12px;
}

.drag-over {
    border-color: var(--nx-primary) !important;
    background-color: var(--nx-primary-light) !important;
}

.text-purple {
    color: var(--nx-purple, #7c3aed);
}

.text-teal {
    color: #14b8a6;
}

/* Tema escuro: sobrescrever placeholder de campos desabilitados que parecem
   "brancos demais" — eles herdam a cor de fundo do card */
[data-theme="dark"] .campo-canvas .form-control:disabled,
[data-theme="dark"] .campo-canvas .form-select:disabled,
[data-theme="dark"] .campo-canvas .form-control[readonly] {
    background-color: var(--nx-input-bg);
    color: var(--nx-text);
    border-color: var(--nx-border);
}

/* =============================================
   NOTIFICAÇÕES PADRONIZADAS - SweetAlert2
   ----------------------------------------------
   Padroniza fonte (Inter), tamanhos e cores em
   todos os alertas do sistema (login, módulos,
   logout, toasts, confirmações).
   ============================================= */

/* Animação spin para ícones de loading (bi-spin é usado em botões durante AJAX) */
@keyframes bi-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.bi-spin {
    display: inline-block;
    animation: bi-spin 0.8s linear infinite;
}

/* Diálogos modais (alertas, confirmações) */
.swal2-popup.nx-swal-popup {
    font-family: var(--nx-font);
    border-radius: var(--nx-radius-xl);
    padding: 22px 24px 20px;
    box-shadow: var(--nx-shadow-lg);
    border: 1px solid var(--nx-border);
    background: var(--nx-card-bg);
    max-width: 460px;
}

.swal2-popup.nx-swal-popup .swal2-icon {
    width: 56px;
    height: 56px;
    margin: 4px auto 14px;
    border-width: 3px;
}
.swal2-popup.nx-swal-popup .swal2-icon .swal2-icon-content {
    font-size: 32px;
}

.swal2-popup.nx-swal-popup .swal2-title {
    font-family: var(--nx-font);
    font-size: 17px;
    font-weight: 700;
    color: var(--nx-text-dark);
    line-height: 1.35;
    padding: 0 0 4px;
    margin: 0 0 4px;
}

.swal2-popup.nx-swal-popup .swal2-html-container {
    font-family: var(--nx-font);
    font-size: 13.5px;
    color: var(--nx-text);
    line-height: 1.55;
    margin: 6px 0 4px;
    padding: 0 6px;
}

.swal2-popup.nx-swal-popup .swal2-actions {
    margin-top: 18px;
    gap: 8px;
}

.swal2-popup.nx-swal-popup .swal2-styled {
    font-family: var(--nx-font);
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--nx-radius);
    padding: 9px 18px;
    box-shadow: none;
    transition: all var(--nx-transition);
}

.swal2-popup.nx-swal-popup .swal2-confirm {
    background: var(--nx-primary) !important;
    border: 1px solid var(--nx-primary) !important;
    color: #fff !important;
}
.swal2-popup.nx-swal-popup .swal2-confirm:hover {
    background: var(--nx-primary-hover) !important;
    border-color: var(--nx-primary-hover) !important;
    transform: translateY(-1px);
}

.swal2-popup.nx-swal-popup .swal2-cancel {
    background: var(--nx-card-bg) !important;
    border: 1px solid var(--nx-border) !important;
    color: var(--nx-text) !important;
}
.swal2-popup.nx-swal-popup .swal2-cancel:hover {
    background: var(--nx-body-bg) !important;
    color: var(--nx-text-dark) !important;
}

.swal2-popup.nx-swal-popup .swal2-deny,
.swal2-popup.nx-swal-popup .swal2-styled.swal2-confirm.swal2-danger,
.swal2-popup.nx-swal-popup .nx-swal-confirm--danger {
    background: var(--nx-danger) !important;
    border: 1px solid var(--nx-danger) !important;
    color: #fff !important;
}
.swal2-popup.nx-swal-popup .nx-swal-confirm--danger:hover {
    background: #b91c1c !important;
    border-color: #b91c1c !important;
    transform: translateY(-1px);
}
.swal2-popup.nx-swal-popup .swal2-styled:focus {
    box-shadow: 0 0 0 3px var(--nx-primary-light) !important;
}

.swal2-popup.nx-swal-popup .swal2-input,
.swal2-popup.nx-swal-popup .swal2-textarea,
.swal2-popup.nx-swal-popup .swal2-select {
    font-family: var(--nx-font);
    font-size: 13.5px;
    color: var(--nx-text-dark);
    background: var(--nx-input-bg);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius);
    padding: 10px 12px;
    box-shadow: none;
}
.swal2-popup.nx-swal-popup .swal2-input:focus,
.swal2-popup.nx-swal-popup .swal2-textarea:focus,
.swal2-popup.nx-swal-popup .swal2-select:focus {
    border-color: var(--nx-primary);
    box-shadow: 0 0 0 3px var(--nx-primary-light);
}

/* Toasts (canto superior direito) */
.swal2-popup.nx-swal-toast {
    font-family: var(--nx-font);
    background: var(--nx-card-bg) !important;
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius);
    box-shadow: var(--nx-shadow-lg);
    padding: 12px 14px;
    min-width: 280px;
    max-width: 360px;
}

.swal2-popup.nx-swal-toast .swal2-title {
    font-family: var(--nx-font);
    font-size: 13px;
    font-weight: 600;
    color: var(--nx-text-dark);
    margin: 0;
    padding: 0 0 0 4px;
    line-height: 1.4;
}

.swal2-popup.nx-swal-toast .swal2-html-container {
    font-family: var(--nx-font);
    font-size: 12.5px;
    color: var(--nx-text);
    margin: 2px 0 0 4px;
    padding: 0;
    line-height: 1.4;
}

.swal2-popup.nx-swal-toast .swal2-icon {
    width: 22px !important;
    height: 22px !important;
    margin: 0 8px 0 0 !important;
    border-width: 2px !important;
    flex-shrink: 0;
}
.swal2-popup.nx-swal-toast .swal2-icon .swal2-icon-content {
    font-size: 13px !important;
}

.swal2-popup.nx-swal-toast .swal2-timer-progress-bar {
    height: 3px;
    background: var(--nx-primary);
}

.swal2-popup.nx-swal-toast.swal2-icon-success .swal2-timer-progress-bar { background: var(--nx-success); }
.swal2-popup.nx-swal-toast.swal2-icon-error   .swal2-timer-progress-bar { background: var(--nx-danger); }
.swal2-popup.nx-swal-toast.swal2-icon-warning .swal2-timer-progress-bar { background: var(--nx-warning); }
.swal2-popup.nx-swal-toast.swal2-icon-info    .swal2-timer-progress-bar { background: var(--nx-info); }

/* Cores dos ícones — bordas e símbolos */
.swal2-popup.nx-swal-popup.swal2-icon-success .swal2-success-ring,
.swal2-popup.nx-swal-toast .swal2-success-ring { border-color: var(--nx-success); }
.swal2-popup.nx-swal-popup .swal2-success-line-tip,
.swal2-popup.nx-swal-popup .swal2-success-line-long,
.swal2-popup.nx-swal-toast .swal2-success-line-tip,
.swal2-popup.nx-swal-toast .swal2-success-line-long { background-color: var(--nx-success); }

.swal2-popup.nx-swal-popup.swal2-icon-error,
.swal2-popup.nx-swal-toast.swal2-icon-error  .swal2-icon { color: var(--nx-danger) !important; border-color: var(--nx-danger) !important; }
.swal2-popup.nx-swal-popup .swal2-x-mark-line-left,
.swal2-popup.nx-swal-popup .swal2-x-mark-line-right,
.swal2-popup.nx-swal-toast .swal2-x-mark-line-left,
.swal2-popup.nx-swal-toast .swal2-x-mark-line-right { background-color: var(--nx-danger); }

.swal2-popup.nx-swal-popup .swal2-warning,
.swal2-popup.nx-swal-toast.swal2-icon-warning .swal2-icon { color: var(--nx-warning) !important; border-color: var(--nx-warning) !important; }

.swal2-popup.nx-swal-popup .swal2-info,
.swal2-popup.nx-swal-popup .swal2-question,
.swal2-popup.nx-swal-toast.swal2-icon-info     .swal2-icon,
.swal2-popup.nx-swal-toast.swal2-icon-question .swal2-icon { color: var(--nx-info) !important; border-color: var(--nx-info) !important; }

/* Backdrop suave */
.swal2-container.nx-swal-backdrop { backdrop-filter: blur(2px); }

/* Tema escuro — overrides finos para o componente padronizado */
[data-theme="dark"] .swal2-popup.nx-swal-popup,
[data-theme="dark"] .swal2-popup.nx-swal-toast {
    background: var(--nx-card-bg) !important;
    border-color: var(--nx-border);
    color: var(--nx-text);
}
[data-theme="dark"] .swal2-popup.nx-swal-popup .swal2-title,
[data-theme="dark"] .swal2-popup.nx-swal-toast .swal2-title { color: var(--nx-text-dark) !important; }
[data-theme="dark"] .swal2-popup.nx-swal-popup .swal2-html-container,
[data-theme="dark"] .swal2-popup.nx-swal-toast .swal2-html-container { color: var(--nx-text) !important; }
[data-theme="dark"] .swal2-popup.nx-swal-popup .swal2-cancel {
    background: var(--nx-input-bg) !important;
    color: var(--nx-text) !important;
    border-color: var(--nx-border) !important;
}
[data-theme="dark"] .swal2-popup.nx-swal-popup .swal2-input,
[data-theme="dark"] .swal2-popup.nx-swal-popup .swal2-textarea,
[data-theme="dark"] .swal2-popup.nx-swal-popup .swal2-select {
    background: var(--nx-input-bg) !important;
    color: var(--nx-text) !important;
    border-color: var(--nx-border) !important;
}

/* =============================================
   MÓDULO: DIÁRIO DO PACIENTE
   (consolidado de modulos/diario.php — usa tokens --nx-*)
   ============================================= */
.diario-container {
    display: flex;
    height: calc(100vh - 220px);
    min-height: 540px;
    background: var(--nx-card-bg);
    border-radius: var(--nx-radius-xl);
    overflow: hidden;
    border: 1px solid var(--nx-border);
    box-shadow: var(--nx-shadow-sm);
}

/* ── Sidebar interna (lista de pacientes) ───────────────────────── */
.diario-sidebar {
    width: 320px;
    min-width: 320px;
    border-right: 1px solid var(--nx-border);
    display: flex;
    flex-direction: column;
    background: var(--nx-body-bg);
}

.diario-sidebar-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--nx-border);
    background: var(--nx-card-bg);
}

.diario-sidebar-search {
    position: relative;
}

.diario-sidebar-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--nx-text-light);
    font-size: 13px;
    pointer-events: none;
}

.diario-sidebar-search input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius);
    font-size: 13px;
    background: var(--nx-card-bg);
    color: var(--nx-text);
    transition: border-color var(--nx-transition), box-shadow var(--nx-transition);
}

.diario-sidebar-search input:focus {
    outline: none;
    border-color: var(--nx-primary);
    box-shadow: 0 0 0 3px var(--nx-primary-light);
}

.diario-sidebar-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--nx-border) transparent;
}

.diario-sidebar-list::-webkit-scrollbar { width: 6px; }
.diario-sidebar-list::-webkit-scrollbar-thumb {
    background: var(--nx-border);
    border-radius: 6px;
}

.diario-paciente-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--nx-border-light);
    transition: background var(--nx-transition);
    border-left: 3px solid transparent;
}

.diario-paciente-item:hover { background: var(--nx-card-bg); }

.diario-paciente-item.ativo {
    background: var(--nx-primary-light);
    border-left-color: var(--nx-primary);
}

.diario-paciente-item .avatar-diario {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--nx-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.diario-paciente-item.ativo .avatar-diario {
    box-shadow: 0 0 0 3px var(--nx-primary-light);
}

.diario-paciente-info {
    flex: 1;
    min-width: 0;
}

.diario-paciente-info .nome {
    font-weight: 600;
    font-size: 13.5px;
    color: var(--nx-text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.diario-paciente-info .meta {
    font-size: 11.5px;
    color: var(--nx-text-muted);
    margin-top: 2px;
}

.diario-paciente-badge {
    background: var(--nx-primary);
    color: #fff;
    border-radius: 12px;
    font-size: 11px;
    padding: 2px 8px;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* ── Área principal ─────────────────────────────────────────────── */
.diario-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--nx-card-bg);
}

.diario-vazio {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--nx-text-muted);
    background: var(--nx-body-bg);
}

.diario-vazio i { color: var(--nx-text-light); }

.diario-header-paciente {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--nx-border);
    flex-wrap: wrap;
    gap: 12px;
    background: var(--nx-card-bg);
}

.diario-header-paciente h5 {
    color: var(--nx-text-dark);
    font-weight: 600;
    font-size: 15px;
}

.diario-header-acoes {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.diario-header-acoes .form-select,
.diario-header-acoes .form-control {
    background-color: var(--nx-card-bg);
    border: 1px solid var(--nx-border);
    color: var(--nx-text);
}

.diario-header-acoes .form-select:focus,
.diario-header-acoes .form-control:focus {
    border-color: var(--nx-primary);
    box-shadow: 0 0 0 3px var(--nx-primary-light);
}

.diario-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--nx-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 15px;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px var(--nx-primary-light);
}

.diario-entradas {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--nx-body-bg);
    scrollbar-width: thin;
    scrollbar-color: var(--nx-border) transparent;
}

.diario-entradas::-webkit-scrollbar { width: 8px; }
.diario-entradas::-webkit-scrollbar-thumb {
    background: var(--nx-border);
    border-radius: 6px;
}

/* ── Cards de entrada ───────────────────────────────────────────── */
.diario-card {
    background: var(--nx-card-bg);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius-lg);
    padding: 14px 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: box-shadow var(--nx-transition), border-color var(--nx-transition), transform var(--nx-transition);
    border-left: 4px solid var(--nx-border);
}

.diario-card:hover {
    box-shadow: var(--nx-shadow);
    border-color: var(--nx-primary);
    transform: translateY(-1px);
}

.diario-card.tipo-texto      { border-left-color: #6366f1; }
.diario-card.tipo-audio      { border-left-color: var(--nx-warning); }
.diario-card.tipo-imagem     { border-left-color: var(--nx-success); }
.diario-card.tipo-video      { border-left-color: var(--nx-danger); }
.diario-card.tipo-documento  { border-left-color: var(--nx-primary); }

.diario-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 10px;
}

.diario-card-badges {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.diario-card-badge {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 999px;
    font-weight: 600;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-tipo-texto      { background: #eef2ff; color: #6366f1; }
.badge-tipo-audio      { background: var(--nx-warning-light); color: #b45309; }
.badge-tipo-imagem     { background: var(--nx-success-light); color: #15803d; }
.badge-tipo-video      { background: var(--nx-danger-light); color: #b91c1c; }
.badge-tipo-documento  { background: var(--nx-primary-light); color: var(--nx-primary); }

.badge-sentimento {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 999px;
    font-weight: 500;
    line-height: 1.2;
}

.sentimento-positivo { background: var(--nx-success-light); color: #15803d; }
.sentimento-neutro   { background: var(--nx-border-light); color: var(--nx-text-muted); }
.sentimento-negativo { background: var(--nx-danger-light); color: #b91c1c; }
.sentimento-ansioso  { background: var(--nx-warning-light); color: #b45309; }
.sentimento-triste   { background: var(--nx-primary-light); color: var(--nx-primary); }

.diario-card-data {
    font-size: 11.5px;
    color: var(--nx-text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.diario-card-conteudo {
    font-size: 13.5px;
    color: var(--nx-text);
    line-height: 1.55;
    max-height: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

.diario-card-resumo {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--nx-border);
    font-size: 12px;
    color: var(--nx-text-muted);
    line-height: 1.5;
}

.diario-card-resumo strong {
    color: var(--nx-text-dark);
    font-weight: 600;
}

.diario-card-status {
    font-size: 11px;
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.status-pendente   { color: var(--nx-warning); }
.status-processado { color: var(--nx-success); }
.status-erro       { color: var(--nx-danger); }

.diario-paginacao {
    padding: 16px 0 8px;
    text-align: center;
}

.diario-paginacao .page-btn {
    background: var(--nx-card-bg);
    border: 1px solid var(--nx-border);
    color: var(--nx-text);
    border-radius: var(--nx-radius);
    padding: 6px 12px;
    margin: 0 3px;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--nx-transition);
}

.diario-paginacao .page-btn:hover:not(:disabled) {
    background: var(--nx-primary-light);
    border-color: var(--nx-primary);
    color: var(--nx-primary);
}

.diario-paginacao .page-btn.active {
    background: var(--nx-primary);
    border-color: var(--nx-primary);
    color: #fff;
}

.diario-paginacao .page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 991.98px) {
    .diario-container {
        flex-direction: column;
        height: auto;
        min-height: auto;
    }
    .diario-sidebar {
        width: 100%;
        min-width: auto;
        max-height: 320px;
        border-right: none;
        border-bottom: 1px solid var(--nx-border);
    }
    .diario-header-acoes {
        width: 100%;
    }
    .diario-header-acoes .form-select,
    .diario-header-acoes .form-control {
        flex: 1;
        min-width: 130px;
    }
}

/* =============================================
   MÓDULO: CENTRAL WHATSAPP
   (consolidado de modulos/whatsapp.php)
   ============================================= */

/* Avatar padronizado — garante proporção quadrada e corte circular sem distorção */
.nx-avatar {
    display: inline-block;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    background: var(--nx-border-light, #e9ecef);
}
.nx-avatar-40 { width: 40px; height: 40px; }
.nx-avatar-45 { width: 45px; height: 45px; }
.nx-avatar-36 { width: 36px; height: 36px; }

/* Pré-visualização de template WhatsApp — legível em light e dark mode */
.nx-template-preview-shell {
    background: var(--nx-whatsapp-chat-bg, #efeae2);
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    justify-content: flex-end;
}
.nx-template-preview-bubble {
    background: #dcf8c6;
    color: #111827;
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.55;
    border-radius: 12px 12px 3px 12px;
    padding: 10px 14px;
    max-width: 85%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    position: relative;
}
[data-theme="dark"] .nx-template-preview-bubble {
    background: var(--nx-whatsapp-enviado, #144d35);
    color: #e2f5d1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* =============================================
   CARDS DE TEMPLATES WHATSAPP
   (padrão visual nx-form-card)
   ============================================= */

.nx-tpl-card {
    background: var(--nx-card-bg);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius-xl);
    box-shadow: var(--nx-shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: box-shadow var(--nx-transition), transform var(--nx-transition);
    border-left: 4px solid var(--nx-success);
}
.nx-tpl-card:hover {
    box-shadow: var(--nx-shadow-lg);
    transform: translateY(-2px);
}
.nx-tpl-card--diario {
    border-left-color: var(--nx-warning);
}
.nx-tpl-card--inactive {
    border-left-color: var(--nx-border);
    opacity: .82;
}
.nx-tpl-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 0;
}
.nx-tpl-card__icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--nx-success-light);
    color: var(--nx-success);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}
.nx-tpl-card__icon-wrap--diario {
    background: #fff8e1;
    color: #b45309;
}
.nx-tpl-card__icon-wrap--inactive {
    background: var(--nx-border-light);
    color: var(--nx-text-muted);
}
.nx-tpl-card__badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .3px;
    padding: 3px 9px;
    border-radius: 20px;
    text-transform: uppercase;
}
.nx-tpl-card__badge--ativo {
    background: var(--nx-success-light);
    color: var(--nx-success);
}
.nx-tpl-card__badge--inativo {
    background: var(--nx-border-light);
    color: var(--nx-text-muted);
}
.nx-tpl-card__badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
}
.nx-tpl-card__body {
    padding: 10px 16px 8px;
    flex: 1;
}
.nx-tpl-card__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--nx-text-dark);
    margin: 0 0 4px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nx-tpl-card__tipo-badge {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
}
.nx-tpl-card__preview {
    font-size: 12px;
    color: var(--nx-text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 54px;
    white-space: pre-line;
}
.nx-tpl-card__meta {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-top: 1px solid var(--nx-border-light);
    border-bottom: 1px solid var(--nx-border-light);
    background: var(--nx-body-bg);
}
.nx-tpl-card__switch {
    margin-left: auto;
}
.nx-tpl-card__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
}
.nx-tpl-card__btn-edit {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--nx-primary);
    background: var(--nx-primary-light);
    border: 1px solid var(--nx-primary-50);
    border-radius: var(--nx-radius);
    cursor: pointer;
    transition: background var(--nx-transition), color var(--nx-transition);
}
.nx-tpl-card__btn-edit:hover {
    background: var(--nx-primary);
    color: #fff;
    border-color: var(--nx-primary);
}
.nx-tpl-card__btn-del {
    width: 33px;
    height: 33px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--nx-radius);
    border: 1px solid var(--nx-border);
    background: var(--nx-card-bg);
    color: var(--nx-text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--nx-transition);
}
.nx-tpl-card__btn-del:hover {
    background: var(--nx-danger-light);
    color: var(--nx-danger);
    border-color: var(--nx-danger);
}

/* Dias da semana estilizados para o modal de lembrete */
.nx-dias-semana {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.nx-dia-btn {
    display: none;
}
.nx-dia-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--nx-border);
    font-size: 12px;
    font-weight: 600;
    color: var(--nx-text-muted);
    cursor: pointer;
    transition: all var(--nx-transition);
    user-select: none;
    background: var(--nx-card-bg);
}
.nx-dia-btn:checked + .nx-dia-label {
    background: var(--nx-primary);
    border-color: var(--nx-primary);
    color: #fff;
}
.nx-dia-label:hover {
    border-color: var(--nx-primary);
    color: var(--nx-primary);
}

#janela-chat {
    background-color: var(--nx-whatsapp-chat-bg, #efeae2);
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d1d5db' fill-opacity='0.15'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.balao-recebido {
    background-color: var(--nx-whatsapp-recebido, #ffffff);
    color: var(--nx-text-dark);
    border-radius: 0 12px 12px 12px;
    padding: 10px 15px;
    max-width: 75%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    align-self: flex-start;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 100px;
}

.balao-enviado {
    background-color: var(--nx-whatsapp-enviado, #d9fdd3);
    color: var(--nx-text-dark);
    border-radius: 12px 0 12px 12px;
    padding: 10px 15px;
    max-width: 75%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    align-self: flex-end;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 100px;
}

.balao-diario {
    background-color: var(--nx-warning-light);
    border-left: 4px solid var(--nx-warning);
    color: var(--nx-text-dark);
    border-radius: 12px;
    padding: 12px 15px;
    max-width: 85%;
    margin: 10px auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.chat-list::-webkit-scrollbar,
#janela-chat::-webkit-scrollbar { width: 6px; }
.chat-list::-webkit-scrollbar-track,
#janela-chat::-webkit-scrollbar-track { background: transparent; }
.chat-list::-webkit-scrollbar-thumb,
#janela-chat::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
}

.chat-item {
    cursor: pointer;
    transition: background 0.2s;
    max-width: 100%;
    overflow: hidden;
}
.chat-item:hover { background-color: var(--nx-border-light) !important; }
.chat-item.ativo {
    background-color: var(--nx-primary-light) !important;
    border-left: 3px solid var(--nx-primary) !important;
}

.min-width-0 { min-width: 0 !important; }

.gravacao-pulso {
    width: 10px;
    height: 10px;
    background-color: var(--nx-danger);
    border-radius: 50%;
    display: inline-block;
    animation: pulsar 1s ease-in-out infinite;
}
@keyframes pulsar {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.6; }
}

#btn-gravar-audio.gravando {
    background-color: var(--nx-danger) !important;
    color: #fff !important;
    animation: pulsar-btn 1.5s ease-in-out infinite;
}
@keyframes pulsar-btn {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(220, 53, 69, 0); }
}

.diario-entrada {
    background: var(--nx-card-bg);
    color: var(--nx-text);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border-left: 4px solid var(--nx-warning);
}
.diario-entrada .diario-tipo-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 50px;
}
.diario-entrada .diario-data {
    font-size: 11px;
    color: var(--nx-text-muted);
}
.diario-entrada .diario-sentimento {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 50px;
}

.paciente-encontrado {
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 8px;
    padding: 10px;
}
.paciente-encontrado:hover { background-color: var(--nx-primary-light); }

.msg-animada { animation: msgEntrar 0.25s ease-out; }
@keyframes msgEntrar {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg-otimista { opacity: 0.85; }

.msg-status-icon { font-size: 11px !important; }

.chat-item-encerrado {
    opacity: 0.6;
    position: relative;
}
.chat-item-encerrado::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0,0.02) 10px, rgba(0,0,0,0.02) 20px);
    pointer-events: none;
}

.badge-contato-pulse { animation: badgePulse 2s ease-in-out infinite; }
@keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(255, 193, 7, 0); }
}

@keyframes nxSlideIn {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

.balao-sistema {
    background-color: var(--nx-border-light);
    border-radius: 8px;
    padding: 8px 14px;
    max-width: 85%;
    margin: 8px auto;
    text-align: center;
    font-size: 12px;
    color: var(--nx-text-muted);
}

.whatsapp-tabs .nav-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--nx-text-muted, #6c757d);
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 6px;
    transition: all 0.2s;
}
.whatsapp-tabs .nav-link i {
    font-size: 14px;
    vertical-align: -1px;
}
.whatsapp-tabs .nav-link .badge {
    font-size: 10.5px;
    padding: 3px 6px;
}
.whatsapp-tabs .nav-link.active {
    color: #25D366;
    border-bottom-color: #25D366;
    background: transparent;
}
.whatsapp-tabs .nav-link:hover:not(.active) {
    color: var(--nx-text-dark, #212529);
    border-bottom-color: var(--nx-border);
}

.contato-item {
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--nx-border-light);
}
.contato-item:hover {
    background-color: var(--nx-primary-light) !important;
}
.contato-item .contato-telefone {
    font-size: 13px;
    color: var(--nx-text-muted);
}
.contato-item .contato-status {
    font-size: 11px;
}

/* =============================================
   TOGGLE DE TEMA (botão na topbar)
   ============================================= */
.topbar-theme-toggle .theme-icon-light,
.topbar-theme-toggle .theme-icon-dark {
    transition: opacity 0.25s ease, transform 0.35s ease;
}
.topbar-theme-toggle .theme-icon-dark { display: none; }
[data-theme="dark"] .topbar-theme-toggle .theme-icon-light { display: none; }
[data-theme="dark"] .topbar-theme-toggle .theme-icon-dark  { display: inline-block; }

.topbar-theme-toggle:hover .theme-icon-light { transform: rotate(35deg); }
.topbar-theme-toggle:hover .theme-icon-dark  { transform: rotate(-15deg); }

/* =============================================
   AJUSTES UNIVERSAIS DE TEMA ESCURO
   (overrides para componentes que usam cores fixas
   e que não foram cobertos pelos tokens --nx-*)
   ============================================= */
[data-theme="dark"] body {
    background: var(--nx-body-bg);
    color: var(--nx-text);
}

/* Bootstrap utilities (bg-white, bg-light, text-dark, text-muted) usadas em
   módulos como WhatsApp / Diário do offcanvas / Header de chat. Mantemos
   compatibilidade visual sem reescrever cada bloco. */
[data-theme="dark"] .bg-white,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .card,
[data-theme="dark"] .offcanvas {
    background-color: var(--nx-card-bg) !important;
    color: var(--nx-text);
}
[data-theme="dark"] .bg-light {
    background-color: var(--nx-body-bg) !important;
    color: var(--nx-text);
}
[data-theme="dark"] .text-dark { color: var(--nx-text-dark) !important; }
[data-theme="dark"] .text-muted { color: var(--nx-text-muted) !important; }
[data-theme="dark"] .text-body { color: var(--nx-text) !important; }
[data-theme="dark"] .border,
[data-theme="dark"] .border-top,
[data-theme="dark"] .border-bottom,
[data-theme="dark"] .border-start,
[data-theme="dark"] .border-end {
    border-color: var(--nx-border) !important;
}
[data-theme="dark"] hr,
[data-theme="dark"] .dropdown-divider {
    border-color: var(--nx-border) !important;
    color: var(--nx-border);
    opacity: 1;
}

/* Inputs/Selects/Textareas — Bootstrap form-control em ambos modos */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .input-group-text,
[data-theme="dark"] .form-check-input {
    background-color: var(--nx-input-bg);
    border-color: var(--nx-border);
    color: var(--nx-text);
}
[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] .form-select::placeholder {
    color: var(--nx-text-light);
}
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: var(--nx-input-bg);
    color: var(--nx-text-dark);
    border-color: var(--nx-primary);
    box-shadow: 0 0 0 3px var(--nx-primary-light);
}
[data-theme="dark"] .form-control:disabled,
[data-theme="dark"] .form-select:disabled,
[data-theme="dark"] .form-control[readonly] {
    background-color: var(--nx-input-disabled-bg);
    color: var(--nx-text-muted);
}
[data-theme="dark"] .form-check-input:checked {
    background-color: var(--nx-primary);
    border-color: var(--nx-primary);
}
[data-theme="dark"] .form-label,
[data-theme="dark"] .form-text {
    color: var(--nx-text);
}

/* Botões secundários e de outline — recálculo do contraste */
[data-theme="dark"] .btn-light,
[data-theme="dark"] .btn-secondary {
    background-color: var(--nx-input-bg);
    border-color: var(--nx-border);
    color: var(--nx-text);
}
[data-theme="dark"] .btn-light:hover,
[data-theme="dark"] .btn-secondary:hover {
    background-color: var(--nx-border);
    color: var(--nx-text-dark);
}
[data-theme="dark"] .btn-outline-secondary {
    color: var(--nx-text);
    border-color: var(--nx-border);
}
[data-theme="dark"] .btn-outline-secondary:hover {
    background-color: var(--nx-input-bg);
    color: var(--nx-text-dark);
    border-color: var(--nx-text-light);
}
[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(180%);
}

/* Tabelas (módulos baseados em view.php e tabelas Bootstrap) */
[data-theme="dark"] .module-table,
[data-theme="dark"] .table {
    color: var(--nx-text);
    border-color: var(--nx-border);
}
[data-theme="dark"] .module-table thead,
[data-theme="dark"] .table thead {
    background: var(--nx-card-bg);
    color: var(--nx-text-muted);
}
[data-theme="dark"] .module-table tbody tr,
[data-theme="dark"] .table tbody tr {
    border-color: var(--nx-border);
}
[data-theme="dark"] .module-table tbody tr:hover,
[data-theme="dark"] .table tbody tr:hover {
    background: var(--nx-table-hover);
}
[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: var(--nx-table-stripe);
    color: var(--nx-text);
}
[data-theme="dark"] .table-success,
[data-theme="dark"] .table-danger,
[data-theme="dark"] .table-warning,
[data-theme="dark"] .table-info {
    --bs-table-bg: transparent;
    color: var(--nx-text);
}

/* Modais Bootstrap (e modais customizados via .nx-modal) */
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    border-color: var(--nx-border);
    background-color: var(--nx-card-bg);
}
[data-theme="dark"] .modal-backdrop {
    background-color: var(--nx-overlay-bg);
}
[data-theme="dark"] .modal-title,
[data-theme="dark"] .offcanvas-title { color: var(--nx-text-dark); }

/* Dropdowns */
[data-theme="dark"] .dropdown-item {
    color: var(--nx-text);
}
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: var(--nx-table-hover);
    color: var(--nx-text-dark);
}
[data-theme="dark"] .dropdown-item.active,
[data-theme="dark"] .dropdown-item:active {
    background-color: var(--nx-primary);
    color: #fff;
}

/* Alerts / Badges baseados em utilitários Bootstrap (bg-opacity) */
[data-theme="dark"] .alert {
    border-color: var(--nx-border);
    background-color: var(--nx-card-bg);
    color: var(--nx-text);
}
[data-theme="dark"] .alert-info    { background-color: rgba(6, 182, 212, 0.12); color: #67e8f9; border-color: rgba(6, 182, 212, 0.3); }
[data-theme="dark"] .alert-success { background-color: rgba(34, 197, 94, 0.12); color: #86efac; border-color: rgba(34, 197, 94, 0.3); }
[data-theme="dark"] .alert-warning { background-color: rgba(245, 158, 11, 0.12); color: #fcd34d; border-color: rgba(245, 158, 11, 0.3); }
[data-theme="dark"] .alert-danger  { background-color: rgba(239, 68, 68, 0.12); color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); }

/* Badges Bootstrap text-bg-light (usado em chips) */
[data-theme="dark"] .badge.bg-light,
[data-theme="dark"] .badge.text-bg-light {
    background-color: var(--nx-input-bg) !important;
    color: var(--nx-text) !important;
}

/* Listas e bordas do offcanvas/modal */
[data-theme="dark"] .list-group-item {
    background-color: var(--nx-card-bg);
    border-color: var(--nx-border);
    color: var(--nx-text);
}

/* Select2 (substituição de cores fixas) */
[data-theme="dark"] .select2-container--default .select2-selection--single,
[data-theme="dark"] .select2-container--default .select2-selection--multiple {
    background-color: var(--nx-input-bg);
    border-color: var(--nx-border);
    color: var(--nx-text);
}
[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--nx-text); }
[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--nx-text-light); }
[data-theme="dark"] .select2-dropdown {
    background-color: var(--nx-card-bg);
    border-color: var(--nx-border);
    color: var(--nx-text);
}
[data-theme="dark"] .select2-search--dropdown .select2-search__field {
    background-color: var(--nx-input-bg);
    border-color: var(--nx-border);
    color: var(--nx-text);
}
[data-theme="dark"] .select2-results__option--highlighted[aria-selected],
[data-theme="dark"] .select2-results__option--highlighted {
    background-color: var(--nx-primary) !important;
    color: #fff !important;
}

/* SweetAlert2 — popup adapta automaticamente ao tema */
[data-theme="dark"] .swal2-popup {
    background: var(--nx-card-bg) !important;
    color: var(--nx-text) !important;
}
[data-theme="dark"] .swal2-title  { color: var(--nx-text-dark) !important; }
[data-theme="dark"] .swal2-html-container,
[data-theme="dark"] .swal2-content { color: var(--nx-text) !important; }
[data-theme="dark"] .swal2-input,
[data-theme="dark"] .swal2-textarea {
    background: var(--nx-input-bg) !important;
    color: var(--nx-text) !important;
    border-color: var(--nx-border) !important;
}

/* FullCalendar (módulo Agenda) */
[data-theme="dark"] .fc {
    --fc-page-bg-color: var(--nx-card-bg);
    --fc-neutral-bg-color: var(--nx-body-bg);
    --fc-border-color: var(--nx-border);
    --fc-today-bg-color: rgba(59, 130, 246, 0.10);
    --fc-list-event-hover-bg-color: var(--nx-table-hover);
    --fc-event-text-color: #fff;
    color: var(--nx-text);
}
[data-theme="dark"] .fc-theme-standard td,
[data-theme="dark"] .fc-theme-standard th,
[data-theme="dark"] .fc-theme-standard .fc-scrollgrid {
    border-color: var(--nx-border);
}
[data-theme="dark"] .fc .fc-toolbar-title { color: var(--nx-text-dark); }
[data-theme="dark"] .fc .fc-col-header-cell-cushion,
[data-theme="dark"] .fc .fc-daygrid-day-number,
[data-theme="dark"] .fc .fc-list-day-cushion { color: var(--nx-text); }
[data-theme="dark"] .fc .fc-button {
    background-color: var(--nx-input-bg);
    border-color: var(--nx-border);
    color: var(--nx-text);
}
[data-theme="dark"] .fc .fc-button-primary:not(:disabled).fc-button-active,
[data-theme="dark"] .fc .fc-button-primary:not(:disabled):active {
    background-color: var(--nx-primary);
    border-color: var(--nx-primary);
    color: #fff;
}

/* Chart.js — labels já usam color CSS herdada quando configuradas no JS;
   apenas garantimos contraste no canvas (tooltip do Chart.js renderiza
   dentro de canvas, não atinge CSS). */
[data-theme="dark"] canvas { color: var(--nx-text); }

/* Inputs com type=date/time exibem ícone do navegador — invertemos no dark */
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(0.85) hue-rotate(180deg);
    cursor: pointer;
}

/* Backgrounds inline de cores fixas presentes em alguns blocos legados */
[data-theme="dark"] [style*="background-color: #f0f2f5"],
[data-theme="dark"] [style*="background-color:#f0f2f5"] {
    background-color: var(--nx-whatsapp-chat-bg) !important;
}
[data-theme="dark"] [style*="background-color: #f8f9fa"],
[data-theme="dark"] [style*="background-color:#f8f9fa"] {
    background-color: var(--nx-body-bg) !important;
}
[data-theme="dark"] [style*="background-color: #fffbf0"],
[data-theme="dark"] [style*="background-color:#fffbf0"] {
    background-color: rgba(245, 158, 11, 0.10) !important;
}

/* Topbar badge no tema escuro precisa de borda diferente */
[data-theme="dark"] .topbar-badge {
    border-color: var(--nx-card-bg);
}

/* Brand-logo: o logotipo é PNG escuro; no dark exibimos versão clara via filtro */
[data-theme="dark"] .brand-logo {
    filter: brightness(0) invert(1);
}

/* =============================================
   NX ALERT TOAST — Notificações flutuantes
   Aparece no canto superior direito
   ============================================= */
#nx-alert-container {
    position: fixed;
    top: 68px;
    right: 16px;
    z-index: 10500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    width: 300px;
}

.nx-alert-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 10px;
    background: var(--nx-card-bg, #fff);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.14);
    border-left: 4px solid transparent;
    pointer-events: auto;
    cursor: default;
    animation: nx-alert-entrar 0.3s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}

.nx-alert-toast.nx-alert-saindo {
    animation: nx-alert-sair 0.28s ease forwards;
}

.nx-alert-whatsapp {
    border-left-color: #25d366;
}

.nx-alert-diario {
    border-left-color: #f59e0b;
}

.nx-alert-icon {
    font-size: 18px;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nx-alert-whatsapp .nx-alert-icon {
    color: #25d366;
    background: rgba(37, 211, 102, 0.13);
}

.nx-alert-diario .nx-alert-icon {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.13);
}

.nx-alert-body {
    flex: 1;
    min-width: 0;
}

.nx-alert-title {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--nx-text-dark, #1a1a2e);
    line-height: 1.2;
}

.nx-alert-text {
    font-size: 11.5px;
    color: var(--nx-text-muted, #6c757d);
    margin-top: 2px;
    line-height: 1.35;
}

.nx-alert-btn {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 11px;
    border-radius: 20px;
    text-decoration: none !important;
    flex-shrink: 0;
    border: 1.5px solid;
    transition: all 0.15s;
}

.nx-alert-whatsapp .nx-alert-btn {
    color: #25d366;
    border-color: #25d366;
}

.nx-alert-whatsapp .nx-alert-btn:hover {
    background: #25d366;
    color: #fff;
}

.nx-alert-diario .nx-alert-btn {
    color: #d97706;
    border-color: #d97706;
}

.nx-alert-diario .nx-alert-btn:hover {
    background: #d97706;
    color: #fff;
}

.nx-alert-close {
    background: none;
    border: none;
    font-size: 17px;
    line-height: 1;
    color: var(--nx-text-muted, #aaa);
    padding: 0;
    margin-left: 2px;
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.nx-alert-close:hover {
    opacity: 1;
}

.nx-alert-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    border-radius: 0 0 0 10px;
    animation: nx-alert-progress linear forwards;
}

.nx-alert-whatsapp .nx-alert-progress { background: #25d366; }
.nx-alert-diario  .nx-alert-progress { background: #f59e0b; }

/* --- Sucesso --- */
.nx-alert-sucesso { border-left-color: var(--nx-success); }
.nx-alert-sucesso .nx-alert-icon       { color: var(--nx-success); background: rgba(22, 163, 74, 0.12); }
.nx-alert-sucesso .nx-alert-btn        { color: var(--nx-success); border-color: var(--nx-success); }
.nx-alert-sucesso .nx-alert-btn:hover  { background: var(--nx-success); color: #fff; }
.nx-alert-sucesso .nx-alert-progress   { background: var(--nx-success); }

/* --- Erro --- */
.nx-alert-erro { border-left-color: var(--nx-danger); }
.nx-alert-erro .nx-alert-icon       { color: var(--nx-danger); background: rgba(220, 38, 38, 0.12); }
.nx-alert-erro .nx-alert-btn        { color: var(--nx-danger); border-color: var(--nx-danger); }
.nx-alert-erro .nx-alert-btn:hover  { background: var(--nx-danger); color: #fff; }
.nx-alert-erro .nx-alert-progress   { background: var(--nx-danger); }

/* --- Aviso --- */
.nx-alert-aviso { border-left-color: var(--nx-warning); }
.nx-alert-aviso .nx-alert-icon       { color: var(--nx-warning); background: rgba(245, 158, 11, 0.12); }
.nx-alert-aviso .nx-alert-btn        { color: var(--nx-warning); border-color: var(--nx-warning); }
.nx-alert-aviso .nx-alert-btn:hover  { background: var(--nx-warning); color: #fff; }
.nx-alert-aviso .nx-alert-progress   { background: var(--nx-warning); }

/* --- Info --- */
.nx-alert-info { border-left-color: var(--nx-info); }
.nx-alert-info .nx-alert-icon       { color: var(--nx-info); background: rgba(8, 145, 178, 0.12); }
.nx-alert-info .nx-alert-btn        { color: var(--nx-info); border-color: var(--nx-info); }
.nx-alert-info .nx-alert-btn:hover  { background: var(--nx-info); color: #fff; }
.nx-alert-info .nx-alert-progress   { background: var(--nx-info); }

@keyframes nx-alert-entrar {
    from { opacity: 0; transform: translateX(60px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes nx-alert-sair {
    from { opacity: 1; transform: translateX(0); max-height: 80px; margin-bottom: 0; }
    to   { opacity: 0; transform: translateX(60px); max-height: 0; margin-bottom: -8px; }
}

@keyframes nx-alert-progress {
    from { width: 100%; }
    to   { width: 0%; }
}

/* Dark theme — toasts adaptam-se automaticamente via var(--nx-card-bg) e var(--nx-text-*) */
[data-theme="dark"] .nx-alert-toast {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}