/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f4f6f9; color: #1a1a2e; font-size: 14px; }

/* ===== LAYOUT ===== */
.app-layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 200px; min-width: 200px; background: #fff; border-right: 1px solid #e5e7eb; display: flex; flex-direction: column; overflow-y: auto; z-index: 100; }
.main-content { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.page { display: none; flex: 1; padding: 28px 32px; }
.page.active { display: block; }

/* ===== SIDEBAR ===== */
.sidebar-logo { padding: 20px 18px 16px; border-bottom: 1px solid #f0f0f0; }
.sidebar-logo .logo-text { font-size: 17px; font-weight: 700; color: #2563eb; letter-spacing: -0.5px; }
.sidebar-logo .logo-text span { font-style: italic; font-weight: 400; }
.sidebar-section { padding: 14px 0 4px; }
.sidebar-section-label { font-size: 10px; font-weight: 600; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.8px; padding: 0 18px 6px; }
.sidebar-nav a { display: block; padding: 7px 18px; color: #4b5563; font-size: 13px; text-decoration: none; border-radius: 0; transition: background 0.15s, color 0.15s; cursor: pointer; }
.sidebar-nav a:hover { background: #f3f4f6; color: #1d4ed8; }
.sidebar-nav a.active { background: #eff6ff; color: #2563eb; font-weight: 500; }
.sidebar-user { margin-top: auto; padding: 14px 18px; border-top: 1px solid #f0f0f0; display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: #3b82f6; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.user-info .user-name { font-size: 12px; font-weight: 600; color: #111827; }
.user-info .user-plan { font-size: 11px; color: #9ca3af; }

/* ===== TOPBAR ===== */
.page-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-title { font-size: 20px; font-weight: 700; color: #111827; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.btn { padding: 7px 16px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all 0.15s; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.btn-secondary:hover { background: #f9fafb; }
.btn-danger { background: #ef4444; color: #fff; width: 100%; padding: 10px; border-radius: 6px; font-size: 14px; font-weight: 500; cursor: pointer; border: none; }
.btn-danger:hover { background: #dc2626; }
select.filter-select { padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 12px; color: #374151; background: #fff; cursor: pointer; }
.emoji-icon { font-size: 18px; }

/* ===== CARDS ===== */
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 20px; }
.card-title { font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 14px; display: flex; align-items: center; gap: 6px; }
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 18px 20px; }
.stat-label { font-size: 11px; font-weight: 600; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 700; color: #111827; }
.stat-value.blue { color: #2563eb; }

/* ===== TABLES ===== */
.table-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; margin-bottom: 20px; }
.table-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid #f0f0f0; }
.table-header h3 { font-size: 13px; font-weight: 600; color: #374151; }
.table-meta { font-size: 12px; color: #9ca3af; }
table { width: 100%; border-collapse: collapse; }
thead th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.4px; background: #f9fafb; border-bottom: 1px solid #e5e7eb; }
tbody tr { border-bottom: 1px solid #f3f4f6; transition: background 0.1s; }
tbody tr:hover { background: #fafafa; }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 10px 14px; font-size: 13px; color: #374151; vertical-align: middle; }
.td-bold { font-weight: 600; color: #111827; }

/* ===== BADGES ===== */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-day { background: #fef3c7; color: #92400e; }
.badge-swing { background: #dbeafe; color: #1e40af; }
.badge-acao { background: #dbeafe; color: #1e40af; }
.badge-fii { background: #f3e8ff; color: #6b21a8; }
.badge-ok { background: #d1fae5; color: #065f46; }
.cv-c { display: inline-flex; width: 20px; height: 20px; border-radius: 50%; background: #d1fae5; color: #065f46; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.cv-v { display: inline-flex; width: 20px; height: 20px; border-radius: 50%; background: #fee2e2; color: #991b1b; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }

/* ===== COLORS ===== */
.text-green { color: #16a34a; font-weight: 600; }
.text-red { color: #dc2626; font-weight: 600; }
.text-blue { color: #2563eb; }
.text-muted { color: #9ca3af; }

/* ===== PAGINATION ===== */
.pagination { display: flex; align-items: center; gap: 4px; padding: 12px 14px; justify-content: flex-end; border-top: 1px solid #f0f0f0; }
.pagination-info { font-size: 12px; color: #9ca3af; margin-right: auto; }
.page-btn { width: 30px; height: 30px; border: 1px solid #e5e7eb; border-radius: 5px; background: #fff; color: #374151; font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.page-btn:hover { background: #f3f4f6; }
.page-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.page-btn:disabled { opacity: 0.4; cursor: default; }

/* ===== FILTERS ===== */
.filters-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }

/* ===== IMPORT PAGE ===== */
.info-banner { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 6px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px; color: #1e40af; display: flex; align-items: flex-start; gap: 8px; }
.dropzone { border: 2px dashed #cbd5e1; border-radius: 8px; padding: 48px 20px; text-align: center; cursor: pointer; transition: border-color 0.2s, background 0.2s; background: #fafafa; }
.dropzone:hover, .dropzone.drag-over { border-color: #2563eb; background: #eff6ff; }
.dropzone-icon { font-size: 40px; margin-bottom: 12px; }
.dropzone-title { font-size: 16px; font-weight: 600; color: #111827; margin-bottom: 6px; }
.dropzone-sub { font-size: 13px; color: #9ca3af; margin-bottom: 16px; }

/* ===== TUTORIAL STEPS ===== */
.tutorial-steps { display: flex; flex-direction: column; gap: 12px; }
.tutorial-step { display: flex; align-items: flex-start; gap: 12px; }
.step-num { width: 24px; height: 24px; border-radius: 50%; background: #2563eb; color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.step-content strong { display: block; font-size: 13px; font-weight: 600; color: #111827; margin-bottom: 2px; }
.step-content span { font-size: 12px; color: #6b7280; }

/* ===== APURACAO PAGE ===== */
.apuracao-summary { display: grid; gap: 12px; margin-bottom: 20px; }
.apuracao-block { padding: 16px 18px; border-radius: 8px; border: 1px solid #e5e7eb; background: #fff; }
.apuracao-block .seg-label { font-size: 11px; font-weight: 600; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.apuracao-block .seg-value { font-size: 22px; font-weight: 700; }
.apuracao-block .seg-detail { font-size: 12px; color: #6b7280; margin-top: 4px; }
.apuracao-block.swing-bg { background: #f0f9ff; border-color: #bae6fd; }
.apuracao-block.fii-bg { background: #faf5ff; border-color: #e9d5ff; }
.apuracao-block.total-bg { background: #f0fdf4; border-color: #bbf7d0; }

/* ===== DARF PAGE ===== */
.darf-status { border: 1px solid #bfdbfe; background: #eff6ff; border-radius: 6px; padding: 12px 16px; margin-bottom: 16px; font-size: 13px; color: #1e40af; display: flex; align-items: center; gap: 8px; }
.darf-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #f3f4f6; }
.darf-row:last-child { border-bottom: none; }
.darf-row-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #374151; }
.darf-row-value { font-size: 13px; font-weight: 500; color: #374151; }
.darf-total-row { display: flex; justify-content: space-between; align-items: center; padding: 16px; background: #fff5f5; border-radius: 0 0 8px 8px; border: 1px solid #e5e7eb; border-top: none; }
.darf-total-row .total-label { font-size: 13px; color: #6b7280; }
.darf-total-row .total-value { font-size: 20px; font-weight: 700; color: #dc2626; }
.darf-total-row .total-value.zero { color: #16a34a; }
.darf-codes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
.darf-code-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px; }
.darf-code-card .dc-type { font-size: 11px; font-weight: 600; color: #9ca3af; margin-bottom: 4px; }
.darf-code-card .dc-detail { font-size: 11px; color: #6b7280; margin-bottom: 8px; }
.darf-code-card .dc-code { font-size: 22px; font-weight: 700; color: #111827; }
.darf-prazo { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px 16px; margin-top: 16px; font-size: 13px; color: #374151; display: flex; align-items: center; gap: 8px; }

/* ===== PREJUIZOS PAGE ===== */
.prejuizo-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; margin-bottom: 16px; overflow: hidden; }
.prejuizo-card-header { padding: 14px 18px; border-bottom: 1px solid #f0f0f0; font-size: 14px; font-weight: 600; color: #111827; display: flex; align-items: center; gap: 8px; }
.prejuizo-inner { padding: 16px; }
.prejuizo-saldo { border-radius: 8px; padding: 14px 16px; margin-bottom: 10px; }
.prejuizo-saldo.swing { background: #f0f9ff; border: 1px solid #bae6fd; }
.prejuizo-saldo.daytrade { background: #faf5ff; border: 1px solid #e9d5ff; }
.prejuizo-saldo.fii { background: #fff7ed; border: 1px solid #fed7aa; }
.prejuizo-saldo .saldo-label { font-size: 10px; font-weight: 600; color: #9ca3af; text-transform: uppercase; margin-bottom: 4px; }
.prejuizo-saldo .saldo-value { font-size: 20px; font-weight: 700; color: #111827; margin-bottom: 2px; }
.prejuizo-saldo .saldo-desc { font-size: 11px; color: #6b7280; }
.btn-corrigir { background: none; border: none; color: #2563eb; font-size: 12px; cursor: pointer; padding: 6px 0; display: flex; align-items: center; gap: 5px; }

/* ===== CONSOLIDAÇÃO PAGE ===== */
.consolidacao-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab-btn { padding: 7px 14px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; border: 1px solid #e5e7eb; background: #fff; color: #6b7280; transition: all 0.15s; display: flex; align-items: center; gap: 6px; }
.tab-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; }

/* ===== CHART AREA ===== */
.chart-area { min-height: 140px; display: flex; align-items: flex-end; justify-content: center; gap: 8px; padding: 16px; }
.chart-bar-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.chart-bar { width: 36px; border-radius: 4px 4px 0 0; min-height: 4px; transition: height 0.3s; }
.chart-bar.negative { background: #ef4444; }
.chart-bar.positive { background: #22c55e; }
.chart-label { font-size: 10px; color: #9ca3af; }

/* ===== PATRIMÔNIO CARD ===== */
.patrimonio-card { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 120px; }
.patrimonio-period { font-size: 11px; color: #9ca3af; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.patrimonio-value { font-size: 28px; font-weight: 700; color: #2563eb; }

/* ===== TERMÔMETRO ===== */
.termometro-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px 18px; margin-bottom: 16px; }
.termometro-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.termometro-label { font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; }
.termometro-pct { font-size: 13px; font-weight: 700; color: #374151; }
.termometro-bar-bg { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.termometro-bar-fill { height: 100%; background: #22c55e; border-radius: 4px; transition: width 0.5s; }
.termometro-text { font-size: 13px; color: #374151; }

/* ===== RESUMO TRIBUTARIO TABLE ===== */
.resumo-table td:first-child { font-weight: 500; }

/* ===== OPERAÇÕES FINALIZADAS ===== */
.ops-finalizadas { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; margin-bottom: 20px; }

/* ===== DICAS ===== */
.dicas-section { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; margin-bottom: 20px; }
.dica-item { border-left: 3px solid #2563eb; padding: 10px 14px; margin: 10px 14px; border-radius: 0 4px 4px 0; background: #f8faff; font-size: 12px; }
.dica-item strong { display: block; font-weight: 600; color: #111827; margin-bottom: 2px; }
.dica-item span { color: #6b7280; }

/* ===== ALERTAS ===== */
.alert-item { display: flex; align-items: center; gap: 8px; padding: 12px 0; font-size: 13px; color: #374151; }
.alert-ok { color: #16a34a; }

/* ===== CARTEIRA PAGE ===== */
.carteira-layout { display: grid; grid-template-columns: 1fr 260px; gap: 20px; }
.pie-chart-container { display: flex; flex-direction: column; align-items: center; }
.pie-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; justify-content: center; }
.pie-legend-item { display: flex; align-items: center; gap: 4px; font-size: 11px; color: #374151; }
.pie-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
canvas { max-width: 100%; }

/* ===== REPORTS PAGE ===== */
.report-item { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 18px; margin-bottom: 12px; text-align: center; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.report-item:hover { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.08); }
.report-item strong { display: block; font-size: 14px; font-weight: 600; color: #111827; margin-bottom: 4px; }
.report-item span { font-size: 12px; color: #9ca3af; }

/* ===== CONFIG PAGE ===== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.form-group input { width: 100%; padding: 9px 12px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 13px; color: #111827; background: #fff; }
.form-group input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.config-data-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid #f3f4f6; font-size: 13px; color: #374151; }
.config-data-row:last-child { border-bottom: none; }
.config-data-row span:last-child { font-weight: 600; color: #111827; }

/* ===== INDEX / LANDING PAGE ===== */
.landing { display: none; min-height: 100vh; background: #fff; flex-direction: column; }
.landing.active { display: flex; }
.landing-nav { display: flex; align-items: center; justify-content: space-between; padding: 16px 48px; border-bottom: 1px solid #f0f0f0; }
.landing-logo { font-size: 20px; font-weight: 700; color: #2563eb; }
.landing-logo span { font-style: italic; font-weight: 400; }
.landing-nav-links { display: flex; align-items: center; gap: 24px; }
.landing-nav-links a { font-size: 14px; color: #4b5563; text-decoration: none; }
.landing-nav-links a:hover { color: #2563eb; }
.landing-hero { text-align: center; padding: 80px 48px 60px; max-width: 800px; margin: 0 auto; }
.landing-hero h1 { font-size: 44px; font-weight: 800; color: #111827; line-height: 1.15; margin-bottom: 20px; }
.landing-hero h1 span { color: #2563eb; }
.landing-hero p { font-size: 17px; color: #6b7280; line-height: 1.6; margin-bottom: 36px; }
.landing-ctas { display: flex; gap: 12px; justify-content: center; }
.landing-cta-primary { background: #2563eb; color: #fff; padding: 12px 28px; border-radius: 8px; font-size: 15px; font-weight: 600; text-decoration: none; border: none; cursor: pointer; transition: background 0.15s; }
.landing-cta-primary:hover { background: #1d4ed8; }
.landing-cta-secondary { background: #fff; color: #374151; padding: 12px 28px; border-radius: 8px; font-size: 15px; font-weight: 600; border: 1.5px solid #e5e7eb; cursor: pointer; transition: all 0.15s; }
.landing-cta-secondary:hover { border-color: #2563eb; color: #2563eb; }
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; padding: 48px; max-width: 1100px; margin: 0 auto; width: 100%; }
.feature-card { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px; padding: 24px; }
.feature-card .feature-icon { font-size: 28px; margin-bottom: 12px; }
.feature-card h3 { font-size: 15px; font-weight: 700; color: #111827; margin-bottom: 8px; }
.feature-card p { font-size: 13px; color: #6b7280; line-height: 1.5; }
.landing-footer { text-align: center; padding: 32px; color: #9ca3af; font-size: 13px; border-top: 1px solid #f0f0f0; margin-top: auto; }

/* ===== LOGIN PAGE ===== */
.auth-page { display: none; min-height: 100vh; background: #f4f6f9; align-items: center; justify-content: center; }
.auth-page.active { display: flex; }
.auth-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 40px; width: 100%; max-width: 420px; }
.auth-logo { text-align: center; margin-bottom: 28px; font-size: 22px; font-weight: 700; color: #2563eb; }
.auth-logo span { font-style: italic; font-weight: 400; }
.auth-title { font-size: 20px; font-weight: 700; color: #111827; margin-bottom: 6px; }
.auth-sub { font-size: 13px; color: #9ca3af; margin-bottom: 24px; }
.auth-link { color: #2563eb; font-size: 13px; text-decoration: none; text-align: center; display: block; margin-top: 16px; }
.auth-divider { text-align: center; color: #9ca3af; font-size: 12px; margin: 16px 0; }

/* ===== MODAL ===== */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal { background: #fff; border-radius: 10px; padding: 28px; width: 90%; max-width: 480px; }
.modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.modal p { font-size: 13px; color: #6b7280; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ===== TOAST ===== */
.toast { position: fixed; bottom: 24px; right: 24px; background: #111827; color: #fff; padding: 12px 20px; border-radius: 8px; font-size: 13px; font-weight: 500; z-index: 9999; transform: translateY(80px); opacity: 0; transition: all 0.3s; pointer-events: none; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: #065f46; }
.toast.error { background: #991b1b; }

/* ===== LOADING ===== */
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,0.85); z-index: 500; display: none; align-items: center; justify-content: center; flex-direction: column; gap: 12px; }
.loading-overlay.active { display: flex; }
.spinner { width: 36px; height: 36px; border: 3px solid #e5e7eb; border-top-color: #2563eb; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar { width: 160px; min-width: 160px; }
  .carteira-layout { grid-template-columns: 1fr; }
  .darf-codes { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; padding: 24px; }
  .stats-row { grid-template-columns: 1fr; }
}
