/* ==========================================================================
   LPM DESIGN SYSTEM - ESTILO VISUAL & VARIÁVEIS (TEMA CLARO E TEMA ESCURO)
   ========================================================================== */

:root {
    /* Tema Claro (Inspirado no dashboard-lpm-light.html - Padrão) */
    --bg-main: #f6f7fb;                 /* Token --paper */
    --bg-card: rgba(255, 255, 255, 0.8);  /* Fundo de card translúcido */
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --border-color: rgba(2, 12, 27, 0.08); /* Token --border-light */
    --border-hover: rgba(2, 12, 27, 0.16);
    
    --color-text: #020c1b;              /* Token --ink-1000 */
    --color-text-muted: #3b4960;        /* Token --on-paper-fg-muted */
    --color-text-dim: #6a7d97;          /* Token --on-paper-fg-dim */
    
    --primary: #1f6bff;                 /* Token --blue-500 azul elétrico */
    --primary-glow: rgba(31, 107, 255, 0.12);
    --primary-hover: #1454c8;
    --secondary: #8b5cf6;               /* Roxo neon para destaques secundários */
    --secondary-glow: rgba(139, 92, 246, 0.1);
    
    --success: #1f9b6b;                 /* Token --ok verde */
    --success-glow: rgba(31, 155, 107, 0.08);
    --warning: #d39327;                 /* Token --warn âmbar */
    --warning-glow: rgba(211, 147, 39, 0.08);
    --danger: #d44a4a;                  /* Token --danger vermelho */
    --danger-glow: rgba(212, 74, 74, 0.08);
    
    --font-display: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --glass-shadow: 0 8px 32px 0 rgba(2, 12, 27, 0.04);
    --modal-shadow: 0 20px 50px 0 rgba(2, 12, 27, 0.15);
    
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

/* Modo Escuro (Ativado via classe no body) */
body.dark-mode {
    --bg-main: #06121f;                 /* Token --ink-900 */
    --bg-card: rgba(11, 26, 45, 0.7);    /* Fundo de card escuro translúcido */
    --bg-card-hover: rgba(11, 26, 45, 0.85);
    --border-color: rgba(42, 69, 105, 0.3); /* Token --ink-700 / --ink-500 */
    --border-hover: rgba(42, 69, 105, 0.5);
    
    --color-text: #f4f6fb;              /* Token --fg */
    --color-text-muted: #c7d2e2;        /* Token --fg-muted / --ink-100 */
    --color-text-dim: #6a7f9c;          /* Token --fg-dim / --ink-300 */
    
    --primary: #1f6bff;                 /* Mantém o azul elétrico da marca */
    --primary-glow: rgba(31, 107, 255, 0.25);
    --primary-hover: #4f8bff;
    
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --modal-shadow: 0 20px 50px 0 rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   RESET & LAYOUT GERAL
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

@font-face {
    font-family: "Surgena";
    src: url("fonts/Surgena-SemiBold.ttf") format("truetype");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 0% 0%, rgba(31, 107, 255, 0.03) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.03) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--color-text);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ==========================================================================
   CABEÇALHO
   ========================================================================== */
header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.4s ease, border-color 0.4s ease;
}

body.dark-mode header {
    background: rgba(6, 18, 31, 0.85);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-logo img {
    height: 42px;
    width: auto;
    object-fit: contain;
}

.header-logo h1 {
    font-family: "Surgena", var(--font-display);
    font-size: 2.2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--color-text) 30%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: rgba(31, 155, 107, 0.08);
    color: var(--success);
    padding: 0.4rem 0.8rem;
    border-radius: 9999px;
    border: 1px solid rgba(31, 155, 107, 0.15);
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px var(--success);
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0% { transform: scale(0.95); opacity: 0.5; }
    50% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.5; }
}

/* ==========================================================================
   ESTRUTURA PRINCIPAL (SIDEBAR + MAIN)
   ========================================================================== */
.main-container {
    display: flex;
    flex: 1;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
    gap: 1.5rem;
}

/* Barra Lateral de Navegação */
nav {
    width: 260px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-shrink: 0;
}

.nav-item {
    background: transparent;
    border: 1px solid transparent;
    color: var(--color-text-muted);
    padding: 0.85rem 1.2rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    text-align: left;
    transition: var(--transition-smooth);
    width: 100%;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    transition: var(--transition-smooth);
}

.nav-item:hover {
    color: var(--color-text);
    background: rgba(2, 12, 27, 0.03);
    border-color: rgba(2, 12, 27, 0.05);
    transform: translateX(4px);
}

body.dark-mode .nav-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: var(--color-text);
    background: var(--bg-card);
    border-color: var(--border-color);
    box-shadow: var(--glass-shadow);
    background-image: linear-gradient(90deg, rgba(31, 107, 255, 0.03) 0%, transparent 100%);
}

.nav-item.active svg {
    stroke: var(--primary);
    filter: drop-shadow(0 0 4px var(--primary));
}

/* Área de Conteúdo Principal */
main {
    flex: 1;
    min-width: 0;
}

.tab-content {
    display: none;
    animation: tabFadeIn 0.35s ease-out forwards;
}

.tab-content.active {
    display: block;
}

@keyframes tabFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   CARDS & COMPONENTES REUTILIZÁVEIS
   ========================================================================== */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: var(--border-hover);
}

.card-header-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--color-text);
}

.card-header-title svg {
    width: 20px;
    height: 20px;
    stroke: var(--primary);
    fill: none;
    stroke-width: 2;
}

/* Botões */
.btn {
    background: var(--primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 10px rgba(31, 107, 255, 0.2);
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(31, 107, 255, 0.3);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--color-text);
    box-shadow: none;
}

.btn-outline:hover {
    background: rgba(2, 12, 27, 0.03);
    border-color: var(--primary);
    color: var(--color-text);
    box-shadow: none;
}

body.dark-mode .btn-outline:hover {
    background: rgba(255, 255, 255, 0.03);
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--color-text);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-icon:hover {
    border-color: var(--primary);
    background: rgba(2, 12, 27, 0.02);
}

body.dark-mode .btn-icon:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges Semânticas */
.badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
    display: inline-block;
}

.badge-primary { background: rgba(31, 107, 255, 0.08); color: var(--primary); border-color: rgba(31, 107, 255, 0.15); }
.badge-success { background: rgba(31, 155, 107, 0.08); color: var(--success); border-color: rgba(31, 155, 107, 0.15); }
.badge-warning { background: rgba(211, 147, 39, 0.08); color: var(--warning); border-color: rgba(211, 147, 39, 0.15); }
.badge-danger { background: rgba(212, 74, 74, 0.08); color: var(--danger); border-color: rgba(212, 74, 74, 0.15); }

/* ==========================================================================
   ABA 1: VISÃO GERAL (OVERVIEW)
   ========================================================================== */
.welcome-banner {
    margin-bottom: 1.5rem;
}

.welcome-banner h2 {
    font-family: "Surgena", var(--font-display);
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.welcome-banner p {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-smooth);
    box-shadow: var(--glass-shadow);
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.stat-info h3 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.35rem;
}

.stat-info .stat-value {
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--color-text);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.client-icon { background: rgba(31, 107, 255, 0.08); color: var(--primary); border: 1px solid rgba(31, 107, 255, 0.15); }
.mmr-icon { background: rgba(139, 92, 246, 0.08); color: var(--secondary); border: 1px solid rgba(139, 92, 246, 0.15); }
.lead-icon { background: rgba(31, 155, 107, 0.08); color: var(--success); border: 1px solid rgba(31, 155, 107, 0.15); }
.task-icon { background: rgba(211, 147, 39, 0.08); color: var(--warning); border: 1px solid rgba(211, 147, 39, 0.15); }

.overview-layout {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 1.5rem;
}

/* Lista de Atividades / Tarefas no Overview */
.task-quick-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.task-quick-item {
    background: rgba(2, 12, 27, 0.015);
    border: 1px solid rgba(2, 12, 27, 0.03);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
}

body.dark-mode .task-quick-item {
    background: rgba(255, 255, 255, 0.015);
    border-color: rgba(255, 255, 255, 0.03);
}

.task-quick-item:hover {
    background: rgba(2, 12, 27, 0.03);
    border-color: var(--border-hover);
}

body.dark-mode .task-quick-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.task-quick-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.task-quick-title {
    font-weight: 600;
    color: var(--color-text);
}

.task-quick-subtitle {
    color: var(--color-text-dim);
    font-size: 0.75rem;
}

/* Finanças no Overview */
.financial-quick-summary {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1.25rem;
}

.fin-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.fin-row .label {
    color: var(--color-text-muted);
}

.fin-row .value {
    font-family: var(--font-display);
    font-weight: 700;
}

.fin-row .value.incoming { color: var(--success); }
.fin-row .value.outgoing { color: var(--danger); }

.fin-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.2rem 0;
}

.fin-row.total {
    font-size: 1rem;
}

.fin-row.total .value {
    font-size: 1.15rem;
    color: var(--color-text);
}

.financial-bar-wrapper {
    height: 8px;
    background: var(--border-color);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.financial-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 9999px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   TABELAS E FILTROS
   ========================================================================== */
.table-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.table-filters input[type="text"] {
    flex: 1;
    min-width: 250px;
}

input[type="text"], input[type="url"], input[type="number"], input[type="date"], select, textarea {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 0.65rem 1rem;
    outline: none;
    transition: var(--transition-smooth);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th, .data-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(2, 12, 27, 0.01);
}

body.dark-mode .data-table th {
    background: rgba(255, 255, 255, 0.01);
}

.data-table tbody tr {
    transition: var(--transition-smooth);
}

.data-table tbody tr:hover {
    background: rgba(2, 12, 27, 0.015);
}

body.dark-mode .data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.015);
}

.table-loading {
    text-align: center;
    color: var(--color-text-dim);
    padding: 3rem !important;
    font-style: italic;
}

.data-table.small th, .data-table.small td {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
}

/* ==========================================================================
   ABA 2: CRM & SUBTAB SELETORES
   ========================================================================== */
.crm-header-tabs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.crm-header-tabs .selectors {
    display: flex;
    gap: 0.5rem;
}

.flow-tab {
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.55rem 1.1rem;
    transition: var(--transition-smooth);
}

.flow-tab:hover {
    color: var(--color-text);
    background: rgba(2, 12, 27, 0.03);
}

body.dark-mode .flow-tab:hover {
    background: rgba(255, 255, 255, 0.03);
}

.flow-tab.active {
    color: var(--primary);
    background: rgba(31, 107, 255, 0.08);
    border-color: rgba(31, 107, 255, 0.15);
}

.crm-sub-tab {
    display: none;
}

.crm-sub-tab.active {
    display: block;
    animation: tabFadeIn 0.35s ease-out forwards;
}

/* Ações nas Tabelas */
.actions-cell {
    display: flex;
    gap: 0.5rem;
}

.btn-action-icon {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--color-text-muted);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-action-icon svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.btn-action-icon:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-glow);
}

.btn-action-icon.delete:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: var(--danger-glow);
}

.btn-action-icon.success:hover {
    color: var(--success);
    border-color: var(--success);
    background: var(--success-glow);
}

/* ==========================================================================
   ABA 4: CLIENTES & GRID
   ========================================================================== */
.section-action-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-action-header h2 {
    font-family: "Surgena", var(--font-display);
    font-size: 1.6rem;
    font-weight: 600;
}

.clients-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.client-project-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.client-project-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
}

.client-project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.client-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.client-card-title h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text);
}

.client-card-title p {
    font-size: 0.8rem;
    color: var(--color-text-dim);
    margin-top: 0.15rem;
}

.client-card-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.client-detail-item {
    display: flex;
    justify-content: space-between;
    color: var(--color-text-muted);
}

.client-detail-item strong {
    color: var(--color-text);
}

.client-card-scope {
    background: rgba(2, 12, 27, 0.015);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
}

body.dark-mode .client-card-scope {
    background: rgba(255, 255, 255, 0.015);
}

.client-card-scope h4 {
    font-family: var(--font-display);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.4rem;
    color: var(--primary);
}

.client-card-scope ul {
    padding-left: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    color: var(--color-text-muted);
}

.client-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: auto;
}

.client-card-actions .btn {
    justify-content: center;
    font-size: 0.8rem;
    padding: 0.55rem;
}

/* ==========================================================================
   ABA 5: FINANCEIRO
   ========================================================================== */
.financial-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.dot-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.bg-success { background-color: var(--success); box-shadow: 0 0 8px var(--success); }
.bg-danger { background-color: var(--danger); box-shadow: 0 0 8px var(--danger); }

.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-primary { color: var(--primary) !important; }

/* ==========================================================================
   MODAIS E DIÁLOGOS
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 12, 27, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--modal-shadow);
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    transform: translateY(30px);
    transition: var(--transition-smooth);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-card.modal-large {
    max-width: 850px;
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-text);
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 1.6rem;
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: var(--transition-smooth);
}

.close-btn:hover {
    background: rgba(2, 12, 27, 0.05);
    color: var(--color-text);
}

body.dark-mode .close-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.25rem;
    margin-top: 1.5rem;
}

/* Grid de seções em modais grandes */
.modal-sections-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.modal-sub-section h4 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 0.5rem;
}

.modal-sub-section.border-left {
    border-left: 1px solid var(--border-color);
    padding-left: 2rem;
}

/* ==========================================================================
   TOAST DE NOTIFICAÇÃO
   ========================================================================== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--success);
    color: #ffffff;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(31, 155, 107, 0.3);
    transform: translateY(100px);
    opacity: 0;
    z-index: 1000;
    transition: var(--transition-smooth);
}

.toast.active {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    background: var(--danger);
    box-shadow: 0 10px 30px rgba(212, 74, 74, 0.3);
}

/* ==========================================================================
   RESPONSIVIDADE E AJUSTES MÓVEIS
   ========================================================================== */
@media (max-width: 992px) {
    .main-container {
        flex-direction: column;
    }
    
    nav {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .nav-item {
        white-space: nowrap;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .overview-layout, .financial-layout, .modal-sections-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-sub-section.border-left {
        border-left: none;
        padding-left: 0;
        margin-top: 1.5rem;
    }
}
