/*!
 * Brittec UI Library v1.0
 * Padrão Visual Premium Enterprise (Baseado em Inter & Phosphor Icons)
 */

/* ==========================================================================
   01. VARIÁVEIS GLOBAIS (DESIGN TOKENS) E RESET
   ========================================================================== */
:root {
    /* Cores de Fundo e Superfície */
    --n-bg: #F8FAFC; 
    --n-surface: #FFFFFF;
    
    /* Bordas */
    --n-border: #E2E8F0;
    --n-border-light: #F1F5F9;
    
    /* Texto e Identidade */
    --n-text: #0F172A;
    --n-muted: #64748B;
    --n-accent: #0284C7; /* Azul Principal Brittec */
    
    /* Sombras Premium */
    --n-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --n-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --n-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --n-drawer-shadow: -10px 0 40px rgba(0, 0, 0, 0.08);

    /* Cores de Squads/Setores */
    --color-squad-dev: #0EA5E9;
    --color-squad-infra: #F59E0B;
    --color-squad-voip: #06B6D4;
    --color-squad-ia: #8B5CF6;
    --color-squad-sec: #EF4444;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--n-bg);
    color: var(--n-text);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar Customizada */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; }

/* Utilitários de Tipografia */
.text-n-text { color: var(--n-text) !important; }
.text-n-muted { color: var(--n-muted) !important; }
.text-n-accent { color: var(--n-accent) !important; }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.min-h-0 { min-height: 0; }

/* ==========================================================================
   02. LAYOUT BASE (APP SHELL)
   ========================================================================== */
.sidebar {
    width: 16rem;
    min-width: 16rem;
    background: #fff;
    border-right: 1px solid var(--n-border);
    z-index: 20;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    height: 64px;
    flex-shrink: 0;
}

.top-header {
    flex-shrink: 0;
    background: transparent;
    border-bottom: 1px solid var(--n-border);
    z-index: 20;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background-color: rgba(248, 250, 252, 0.8);
    /* position: sticky; */
    top: 0;
}

.main-area {
    min-width: 0;
    background: var(--n-bg);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ==========================================================================
   03. COMPONENTES: BOTÕES
   ========================================================================== */
.btn-neural {
    background: var(--n-text);
    color: #fff;
    border: 0;
    padding: 0.5rem 1.25rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    transition: 0.2s;
    box-shadow: var(--n-shadow-sm);
    cursor: pointer;
    text-decoration: none;   /* aplica também a <a class="btn-neural"> */
}

.btn-neural:hover,
.btn-neural:focus {
    background: #000;
    color: #fff;
    box-shadow: var(--n-shadow-md);
    transform: translateY(-1px);
    text-decoration: none;
}

.btn-outline-neural {
    background: #fff;
    color: var(--n-text);
    border: 1px solid var(--n-border);
    padding: 0.5rem 1.25rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    transition: 0.2s;
    box-shadow: var(--n-shadow-sm);
    cursor: pointer;
    text-decoration: none;   /* aplica também a <a class="btn-outline-neural"> */
}

.btn-outline-neural:hover,
.btn-outline-neural:focus {
    background: #F8FAFC;
    border-color: #CBD5E1;
    color: var(--n-text);
    text-decoration: none;
}

.btn-icon {
    background: transparent;
    border: 1px solid transparent;
    color: var(--n-muted);
    padding: 0.375rem;
    border-radius: 0.375rem;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.btn-icon:hover {
    background: #F1F5F9;
    color: var(--n-text);
    border-color: var(--n-border);
}

/* ==========================================================================
   04. COMPONENTES: CARDS E KPIS
   ========================================================================== */
.n-card {
    background: #fff;
    border: 1px solid var(--n-border);
    border-radius: 1rem;
    box-shadow: var(--n-shadow-sm);
    transition: box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.n-card:hover {
    box-shadow: var(--n-shadow-md);
    border-color: #CBD5E1;
}

.card-header-premium {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--n-border-light);
    background: #fff;
}

.card-title-premium {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--n-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.01em;
}

.card-icon {
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    background: #F1F5F9;
    border: 1px solid var(--n-border);
    box-shadow: var(--n-shadow-sm);
}

/* KPIs */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: #fff;
    border: 1px solid var(--n-border);
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: var(--n-shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: 0.2s;
}

.kpi-card:hover {
    border-color: #CBD5E1;
    box-shadow: var(--n-shadow-md);
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--n-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--n-text);
    margin-top: 0.5rem;
    letter-spacing: -0.02em;
    line-height: 1;
}

/* ==========================================================================
   05. COMPONENTES: FORMULÁRIOS E INPUTS
   ========================================================================== */
.form-label.n-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--n-muted);
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
}

.n-input, .form-select.n-input {
    width: 100%;
    border: 1px solid var(--n-border);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: 0.2s;
    background: #fff;
    color: var(--n-text);
}

.n-input:focus {
    outline: none;
    border-color: var(--n-accent);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
}

.n-input::placeholder { color: #94A3B8; }

.input-group-text.n-addon {
    background: #F8FAFC;
    border: 1px solid var(--n-border);
    border-right: none;
    color: var(--n-muted);
    border-radius: 0.375rem 0 0 0.375rem;
    font-weight: 600;
    font-size: 0.875rem;
}

.n-input.with-addon { border-radius: 0 0.375rem 0.375rem 0; }

/* Input Seguro (Com botão Eye integrado) */
.secure-input-group { display: flex; align-items: stretch; position: relative; }
.secure-input-group .n-input { padding-right: 2.5rem; }
.secure-btn {
    position: absolute;
    right: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--n-muted);
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    transition: 0.2s;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}
.secure-btn:hover { color: var(--n-text); }

/* Switch & Checkbox */
.form-check-input:checked { background-color: var(--n-text); border-color: var(--n-text); }

/* ==========================================================================
   06. COMPONENTES: BADGES, STATUS E AVATAR
   ========================================================================== */
.n-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid transparent;
}

.badge-success { background: #ECFDF5; color: #059669; border-color: #A7F3D0; }
.badge-warning { background: #FFFBEB; color: #D97706; border-color: #FDE68A; }
.badge-danger { background: #FEF2F2; color: #DC2626; border-color: #FCA5A5; }
.badge-dark { background: #F1F5F9; color: #334155; border-color: #E2E8F0; }

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.status-dot.active { background: #10B981; box-shadow: 0 0 0 3px #D1FAE5; }
.status-dot.pending { background: #F59E0B; box-shadow: 0 0 0 3px #FEF3C7; }

.n-avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--n-text);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* ==========================================================================
   07. COMPONENTES: TABELAS GERAIS
   ========================================================================== */
.n-table { width: 100%; border-collapse: collapse; }
.n-table th {
    background: #F8FAFC;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--n-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid var(--n-border);
    text-align: left;
}
.n-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--n-border-light);
    vertical-align: middle;
    transition: background 0.2s;
}
.n-table tbody tr:hover td { background: #F8FAFC; cursor: pointer; }
.n-table tbody tr:last-child td { border-bottom: none; }

/* ==========================================================================
   08. COMPONENTES: NAVEGAÇÃO INTERNA (TABS & SIDEBAR LINKS)
   ========================================================================== */
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    text-decoration: none;
    font-weight: 500;
    color: var(--n-muted);
    transition: all 0.2s ease;
}
.sidebar-link:hover, .sidebar-link.active { color: var(--n-text); background: #F1F5F9; }
.sidebar-link.active { font-weight: 600; border: 1px solid var(--n-border); }
.sidebar-link i { font-size: 1.125rem; margin-right: 0.75rem; }

.project-nav {
    display: flex;
    gap: 1.5rem;
    margin-top: 1.5rem;
    border-bottom: 1px solid var(--n-border);
    overflow-x: auto;
}
.p-tab {
    padding: 0.75rem 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--n-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    white-space: nowrap;
}
.p-tab:hover { color: var(--n-text); }
.p-tab.active { color: var(--n-text); font-weight: 600; border-bottom-color: var(--n-accent); }

/* ==========================================================================
   09. OVERLAYS: TOASTS (NOTIFICAÇÕES)
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.n-toast {
    background: #fff;
    border: 1px solid var(--n-border);
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: var(--n-shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 320px;
    max-width: 420px;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
    opacity: 0;
    border-left: 4px solid transparent;
    pointer-events: auto;
}

.n-toast.show { transform: translateX(0); opacity: 1; }
.n-toast.success { border-left-color: #10B981; }
.n-toast.success .toast-icon { color: #10B981; }
.n-toast.error { border-left-color: #EF4444; }
.n-toast.error .toast-icon { color: #EF4444; }
.n-toast.info { border-left-color: #0284C7; }
.n-toast.info .toast-icon { color: #0284C7; }

.toast-icon { font-size: 1.25rem; margin-top: 2px; }
.toast-content { flex: 1; }
.toast-title { font-weight: 700; color: var(--n-text); font-size: 0.875rem; margin-bottom: 0.125rem; }
.toast-message { font-size: 0.8125rem; color: var(--n-muted); line-height: 1.4; }

/* ==========================================================================
   10. OVERLAYS: DRAWERS (GAVETAS LATERAIS)
   ========================================================================== */
.n-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s ease;
}
.n-drawer-overlay.show { opacity: 1; visibility: visible; }

/* Overlay pelo id — o base.html renderiza <div id="drawer-overlay"> compartilhado
   por todos os módulos. Alguns módulos redeclaram este CSS, mas garantimos aqui
   um fallback global pra qualquer página que use drawers. */
#drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s ease;
}
#drawer-overlay.show { opacity: 1; visibility: visible; }

.n-drawer {
    position: fixed;
    inset-block: 0;
    right: 0;
    width: 100%;
    max-width: 500px;
    background: #fff;
    box-shadow: var(--n-drawer-shadow);
    z-index: 1055;
    transform: translateX(100%);
    transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--n-border);
}
.n-drawer.open { transform: translateX(0); }

.drawer-header { padding: 1.5rem; border-bottom: 1px solid var(--n-border); background: #F8FAFC; display: flex; justify-content: space-between; align-items: flex-start; }
.drawer-body { flex: 1; overflow-y: auto; padding: 1.5rem; }
.drawer-footer { padding: 1.25rem 1.5rem; border-top: 1px solid var(--n-border); background: #F8FAFC; display: flex; gap: 0.75rem; justify-content: flex-end; }

/* --- Aliases modernos com prefixo n- (usados nos módulos novos:
   receitas, dre, fiscal, socios). Mesmos estilos, nomes espelhados
   pra alinhar com a convenção n-card / n-input. -------------------- */
.n-drawer-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--n-border);
    background: #F8FAFC;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-shrink: 0;
}
.n-drawer-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--n-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.3;
}
.n-drawer-title i { font-size: 1.375rem; }

.n-drawer-close {
    background: transparent;
    border: 1px solid transparent;
    color: var(--n-muted);
    width: 32px; height: 32px;
    border-radius: 0.375rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    cursor: pointer;
    transition: 0.15s;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}
.n-drawer-close:hover {
    background: #F1F5F9;
    color: var(--n-text);
    border-color: var(--n-border);
}

.n-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.n-drawer-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--n-border);
    background: #F8FAFC;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* Variante wide — pra drawers com tabelas/listas (recorrências, drill, etc.) */
.n-drawer.n-drawer-wide { max-width: 720px; }

/* ==========================================================================
   11. MÓDULOS ESPECÍFICOS (CODE BLOCKS, LOGIN SPLIT)
   ========================================================================== */

/* Blocos de Código (Prose / Markdown / JSON View) */
.code-block {
    background: #F1F4F9;
    color: #1F2937;
    padding: 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    line-height: 1.6;
    overflow-x: auto;
    border: 1px solid var(--n-border);
    margin-bottom: 1.5rem;
    font-family: 'JetBrains Mono', monospace;
}
.code-key { color: #0284C7; } 
.code-string { color: #059669; } 
.code-number { color: #D97706; } 
.code-err { color: #DC2626; font-weight: bold; }

/* Estrutura Específica do Login Split Screen */
.login-wrapper { display: flex; min-height: 100vh; }
.form-side { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 2rem; position: relative; background: var(--n-surface); }
.brand-side { flex: 1; display: none; background: #0F172A; position: relative; overflow: hidden; padding: 4rem; color: #fff; flex-direction: column; justify-content: center; }
@media (min-width: 992px) { .brand-side { display: flex; } }

