:root {
    /* Paleta de Cores Modernas (Interface Profissional) */
    --primary-color: #0f172a; /* Slate 900 - Azul Marinho Profundo */
    --primary-hover: #1e293b; /* Slate 800 */
    --accent-color: #3b82f6; /* Blue 500 - Destaque */
    --accent-hover: #2563eb; /* Blue 600 */
    --success-color: #10b981; /* Emerald 500 */
    --warning-color: #f59e0b; /* Amber 500 */
    --danger-color: #ef4444; /* Red 500 */
    --background-body: #f8fafc; /* Slate 50 */
    --background-card: #ffffff;
    --text-main: #334155; /* Slate 700 */
    --text-muted: #64748b; /* Slate 500 */
    --border-color: #e2e8f0; /* Slate 200 */
    
    /* Espaçamento e Formas */
    --border-radius-sm: 0.375rem; /* 6px */
    --border-radius-md: 0.75rem;  /* 12px */
    --border-radius-lg: 1rem;     /* 16px */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--background-body);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--primary-color);
    letter-spacing: -0.025em;
}

/* Navbar Superior */
.navbar {
    background-color: var(--primary-color) !important;
    box-shadow: var(--shadow-md);
    padding: 0.75rem 1rem;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.5px;
}

/* Sidebar Modernizada */
.sidebar {
    background-color: #ffffff;
    border-right: 1px solid var(--border-color);
    padding-top: 1.5rem;
    padding-bottom: 2rem;
}

.sidebar .nav-link {
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-md);
    margin-bottom: 0.35rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Container para ícones garantindo alinhamento perfeito */
.sidebar .nav-link i {
    width: 24px;
    text-align: center;
    margin-right: 0.75rem;
    font-size: 1.1rem;
    transition: transform 0.2s ease;
    color: #94a3b8; /* Slate 400 */
}

/* Estado Hover */
.sidebar .nav-link:hover {
    color: var(--primary-color);
    background-color: #f8fafc; /* Slate 50 */
    transform: translateX(4px); /* Sutil movimento para direita */
}

.sidebar .nav-link:hover i {
    color: var(--accent-color);
    transform: scale(1.1); /* Sutil zoom no ícone */
}

/* Estado Ativo (Destaque Principal) */
.sidebar .nav-link.active {
    background: linear-gradient(135deg, var(--primary-color), #1e293b);
    color: #ffffff !important;
    box-shadow: 0 4px 12px -2px rgba(15, 23, 42, 0.25); /* Sombra elegante */
    font-weight: 600;
}

.sidebar .nav-link.active i {
    color: #60a5fa; /* Azul claro (Blue 400) para contraste no fundo escuro */
}

/* Cabeçalhos de Seção */
.sidebar-heading {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
    color: #cbd5e1; /* Slate 300 - bem discreto */
    margin: 1.75rem 0 0.5rem 1rem !important;
    display: flex;
    align-items: center;
}

.sidebar-heading span {
    position: relative;
    z-index: 1;
    background-color: #fff;
    padding-right: 10px;
}

/* Linha separadora sutil ao lado do título */
.sidebar-heading::after {
    content: '';
    flex-grow: 1;
    height: 1px;
    background-color: #f1f5f9;
    margin-right: 1rem;
}

/* Cards */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    background-color: var(--background-card);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Botões */
.btn {
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* Login Page Specifics */
.login-page {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.login-header {
    background-color: var(--primary-color);
    padding: 2rem;
    text-align: center;
    color: white;
}

/* No login, títulos precisam herdar branco (a regra global de h1..h6 força cor escura) */
.login-header h1,
.login-header h2,
.login-header h3,
.login-header h4,
.login-header h5,
.login-header h6 {
    color: #ffffff;
}

/* Status Badges */
.badge {
    padding: 0.5em 0.75em;
    font-weight: 600;
    border-radius: 9999px; /* Pill shape */
}

.bg-success { background-color: #dcfce7 !important; color: #166534; }
.bg-warning { background-color: #fef3c7 !important; color: #92400e; }
.bg-danger { background-color: #fee2e2 !important; color: #991b1b; }
.bg-primary { background-color: #dbeafe !important; color: #1e40af; } /* Using as 'Novo' */
.bg-info    { background-color: #e0f2fe !important; color: #075985; }

/* Inputs */
.form-control, .form-select {
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    padding: 0.625rem 0.875rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Dashboard Stats Cards Overrides */
.stat-card {
    border: none;
    position: relative;
    overflow: hidden;
}

.stat-card .card-body {
    position: relative;
    z-index: 2;
}

.stat-card i {
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 5rem !important;
    opacity: 0.1 !important;
    transform: rotate(-15deg);
    z-index: 1;
}

/* Cores específicas para stat cards (sobrescrevendo Bootstrap text-white) */
.stat-card.bg-primary { background: linear-gradient(135deg, #3b82f6, #2563eb) !important; }
.stat-card.bg-warning { background: linear-gradient(135deg, #f59e0b, #d97706) !important; color: white !important; }
.stat-card.bg-success { background: linear-gradient(135deg, #10b981, #059669) !important; }
.stat-card.bg-danger  { background: linear-gradient(135deg, #ef4444, #dc2626) !important; }

/* Utilitários do Agiliza (substitui estilos inline para conformidade) */
.brand-subtitle {
    font-size: 0.65rem;
    font-weight: 400;
    opacity: 0.8;
    letter-spacing: 1px;
}

.avatar-32 {
    width: 32px;
    height: 32px;
}

.user-name {
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
}

.footer-version {
    font-size: 0.7rem;
}

.cnae-results {
    z-index: 1050;
    display: none;
    max-height: 280px;
    overflow: auto;
}

.icon-callout {
    font-size: 1.6rem;
    line-height: 1;
}

.icon-callout-lg {
    font-size: 1.8rem;
    line-height: 1;
}

.ws-prewrap {
    white-space: pre-wrap;
}

.col-ordem {
    width: 80px;
}
