/**
 * AVALON Design System
 * Manual de Identidade Visual - Avalon Asset Management
 *
 * Conceito: Equilíbrio entre racionalidade e afeto
 * Inspiração: Arquitetura modernista de Brasília, Athos Bulcão
 *
 * Cores:
 * - Azul Marinho: #000073 (confiança, solidez)
 * - Azul Claro: #50A0FF (céu de Brasília, leveza)
 */

/* ═══════════════════════════════════════════════════════════════
   FONTS - Poppins (corpo) + fallback para títulos
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ═══════════════════════════════════════════════════════════════
   CSS CUSTOM PROPERTIES (Avalon Brand Tokens)
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* === Avalon Primary: Azul Marinho === */
  --avalon-900: #000073;
  --avalon-800: #00005C;
  --avalon-700: #000045;
  --avalon-600: #00002E;
  --avalon-500: #33338F;
  --avalon-400: #6666AB;
  --avalon-300: #9999C7;
  --avalon-200: #CCCCE3;
  --avalon-100: #E6E6F1;
  --avalon-50: #F3F3F8;

  /* === Avalon Secondary: Azul Claro (Céu de Brasília) === */
  --sky-500: #50A0FF;
  --sky-400: #73B3FF;
  --sky-300: #96C6FF;
  --sky-200: #B9D9FF;
  --sky-100: #DCECFF;
  --sky-600: #4080CC;
  --sky-700: #306099;
  --sky-800: #204066;
  --sky-900: #102033;

  /* === Buckets (Layers) — ID Manual Colors === */
  --bucket-preservacao: var(--sky-500);   /* Azul Claro (Sky) */
  --bucket-manutencao: #E6E6F1;           /* Branco gelo */
  --bucket-ganho: var(--avalon-900);      /* Azul Marinho (Avalon 900) */

  /* === Product Categories (Avalon palette alt) === */
  --product-renda-fixa: var(--avalon-900);   /* Deep Navy */
  --product-fundos: var(--avalon-700);       /* Navy 700 */
  --product-alternativos: var(--avalon-500); /* Navy 500 */
  --product-caixa: var(--sky-500);           /* Sky accent */

  /* === Composition (Product) Palette — Muted Avalon === */
  --comp-renda-fixa: var(--avalon-900);
  --comp-fundos: var(--avalon-700);
  --comp-alternativos: var(--avalon-500);
  --comp-caixa: var(--sky-400);

  /* === Neutrals (Escala de Cinza) === */
  --gray-900: #0D0D0D;
  --gray-800: #1D1D1D;
  --gray-700: #3D3D3D;
  --gray-600: #585858;
  --gray-500: #6E6E6E;
  --gray-400: #929292;
  --gray-300: #A8A8A8;
  --gray-200: #BEBEBE;
  --gray-100: #D4D4D4;
  --gray-50: #E9E9E9;

  /* === Semantic Colors === */
  --success-500: #22c55e;
  --success-400: #4ade80;
  --danger-500: #ef4444;
  --danger-400: #f87171;
  --warning-500: #f59e0b;
  --warning-400: #fbbf24;

  /* === Typography === */
  --font-display: 'Poppins', system-ui, -apple-system, sans-serif;
  --font-body: 'Poppins', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* === Font Sizes === */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  --text-6xl: 3.75rem;

  /* === Spacing === */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* === Border Radius === */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* === Shadows === */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 115 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 115 / 0.1), 0 2px 4px -2px rgb(0 0 115 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 115 / 0.1), 0 4px 6px -4px rgb(0 0 115 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 115 / 0.15), 0 8px 10px -6px rgb(0 0 115 / 0.1);
  --shadow-avalon: 0 25px 50px -12px rgb(0 0 115 / 0.25);

  /* === Transitions === */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
}

/* ═══════════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: white;
  background: var(--avalon-900);
  min-height: 100vh;
}

/* === Grafismo Background (inspirado em Athos Bulcão) === */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  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%3Cpath d='M30 5 C40 5 50 15 50 30 C50 32 49 34 48 36' stroke='%2350A0FF' stroke-width='2' fill='none' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: -1;
}

/* ═══════════════════════════════════════════════════════════════
   THEME: MUTED (menos azul, mais neutro)
   ═══════════════════════════════════════════════════════════════ */
body.theme-muted {
  background: var(--gray-900);
}

body.theme-muted::before {
  opacity: 0.005;
}

.theme-muted .header {
  background: rgba(13, 13, 13, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.theme-muted .page-subtitle { color: var(--gray-300); }
.theme-muted .page-meta { color: var(--gray-400); }
.theme-muted .overline { color: var(--gray-300); }

.theme-muted .card,
.theme-muted .stat-card {
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.theme-muted .card:hover,
.theme-muted .stat-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.theme-muted .card-highlight {
  border-color: var(--avalon-400);
  background: linear-gradient(135deg, rgba(17,24,39,0.95) 0%, rgba(102,102,171,0.08) 100%);
}

.theme-muted .tab.active { border-bottom-color: var(--avalon-400); }

.theme-muted .chart-container {
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ═══════════════════════════════════════════════════════════════
   THEME: LIGHT (site branco)
   ═══════════════════════════════════════════════════════════════ */
body.theme-light {
  background: #ffffff;
  color: var(--gray-800);
}

body.theme-light::before { display: none; }

.theme-light .header {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid #e5e7eb; /* slate-200 */
}

.theme-light h1, .theme-light h2, .theme-light h3,
.theme-light h4, .theme-light h5, .theme-light h6 {
  color: var(--gray-900);
}

.theme-light .overline { color: var(--gray-600); }
.theme-light .page-subtitle { color: var(--gray-600); }
.theme-light .page-meta { color: var(--gray-500); }
.theme-light .page-meta-divider { background: var(--gray-300); }

.theme-light .nav-link { color: var(--gray-600); }
.theme-light .nav-link:hover { color: var(--gray-800); }
.theme-light .nav-link.active { color: #0F172A; }
.theme-light .nav-link.active::after { background: #0F172A; }

.theme-light .card,
.theme-light .stat-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
}

.theme-light .card:hover,
.theme-light .stat-card:hover { box-shadow: 0 10px 24px -12px rgba(0,0,0,0.15); }

.theme-light .card-title { color: var(--gray-900); }
.theme-light .card-subtitle { color: var(--gray-600); }
.theme-light .stat-label { color: var(--gray-500); }
.theme-light .stat-value { color: var(--gray-900); }

.theme-light .table-container { border-color: #e5e7eb; }
.theme-light thead { background: #f8fafc; }
.theme-light th { color: var(--gray-600); border-bottom-color: #e5e7eb; }
.theme-light td { border-bottom-color: #f1f5f9; color: var(--gray-800); }

.theme-light .chart-container { background: #ffffff; border: 1px solid #e5e7eb; }

.theme-light .bucket-legend-label { color: var(--gray-600); }
.theme-light .bucket-legend-value { color: var(--gray-800); }

   TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: white;
}

h1 { font-size: var(--text-5xl); letter-spacing: 0.05em; }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
  margin-bottom: var(--space-4);
  max-width: 65ch;
}

.lead {
  font-size: var(--text-xl);
  font-weight: 300;
  color: var(--sky-200);
  line-height: 1.5;
}

.overline {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--sky-500);
}

.caption {
  font-size: var(--text-sm);
  color: var(--avalon-300);
}

/* === Number Display === */
.number-display {
  font-family: var(--font-body);
  font-size: var(--text-4xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.number-display-sm {
  font-size: var(--text-2xl);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════ */

.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-narrow { max-width: 900px; }
.container-wide { max-width: 1600px; }

/* === Grid System === */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* === Flex === */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ═══════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════ */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(0, 0, 115, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(80, 160, 255, 0.2);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}

.logo {
  height: 32px;
  width: auto;
}

.logo-text {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: white;
  text-decoration: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.nav-link {
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--avalon-300);
  text-decoration: none;
  transition: color var(--transition-fast);
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: white;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--sky-500);
}

/* ═══════════════════════════════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════════════════════════════ */

.page-header {
  padding: var(--space-12) 0 var(--space-8);
  border-bottom: 1px solid rgba(80, 160, 255, 0.15);
  margin-bottom: var(--space-8);
  position: relative;
}

/* Grafismo decorativo no header */
.page-header::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle at center, var(--sky-500) 0%, transparent 70%);
  opacity: 0.08;
  border-radius: 50%;
  transform: translate(30%, -30%);
}

.page-title {
  font-size: var(--text-5xl);
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-3);
}

.page-subtitle {
  font-size: var(--text-lg);
  font-weight: 300;
  color: var(--avalon-300);
}

.page-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  color: var(--avalon-400);
}

.page-meta-divider {
  width: 4px;
  height: 4px;
  background: var(--sky-500);
  border-radius: var(--radius-full);
}

/* ═══════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════ */

.card {
  background: linear-gradient(135deg, rgba(0, 0, 92, 0.8) 0%, rgba(0, 0, 69, 0.9) 100%);
  border: 1px solid rgba(80, 160, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-avalon);
  border-color: rgba(80, 160, 255, 0.3);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid rgba(80, 160, 255, 0.1);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--avalon-400);
  margin-top: var(--space-1);
  text-transform: none;
  letter-spacing: normal;
}

.card-body { flex: 1; }

.card-footer {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(80, 160, 255, 0.1);
}

/* Card Variants */
.card-highlight {
  border-color: var(--sky-500);
  background: linear-gradient(135deg, rgba(0, 0, 92, 0.9) 0%, rgba(80, 160, 255, 0.1) 100%);
}

.card-success { border-left: 3px solid var(--success-500); }
.card-danger { border-left: 3px solid var(--danger-500); }
.card-warning { border-left: 3px solid var(--warning-500); }

/* ═══════════════════════════════════════════════════════════════
   STAT CARD
   ═══════════════════════════════════════════════════════════════ */

.stat-card {
  position: relative;
  padding: var(--space-6);
  background: linear-gradient(135deg, rgba(0, 0, 92, 0.8) 0%, rgba(0, 0, 69, 0.9) 100%);
  border: 1px solid rgba(80, 160, 255, 0.15);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--stat-color, var(--sky-500));
}

/* Arco decorativo (grafismo do "O" do logo) */
.stat-card::after {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 120px;
  height: 120px;
  border: 3px solid var(--stat-color, var(--sky-500));
  border-radius: 50%;
  opacity: 0.1;
  clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%);
}

.stat-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--avalon-400);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-2);
}

.stat-value {
  font-family: var(--font-body);
  font-size: var(--text-3xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: white;
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  margin-top: var(--space-2);
}

.stat-trend.up { color: var(--success-400); }
.stat-trend.down { color: var(--danger-400); }
.stat-trend.neutral { color: var(--avalon-400); }

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: var(--sky-500);
  color: var(--avalon-900);
}

.btn-primary:hover {
  background: var(--sky-400);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(80, 160, 255, 0.3);
}

.btn-secondary {
  background: transparent;
  border-color: var(--sky-500);
  color: var(--sky-500);
}

.btn-secondary:hover {
  background: var(--sky-500);
  color: var(--avalon-900);
}

.btn-ghost {
  background: transparent;
  color: var(--avalon-300);
}

.btn-ghost:hover {
  color: white;
  background: rgba(80, 160, 255, 0.1);
}

/* ═══════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-sm);
}

.badge-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success-400);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger-400);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning-400);
}

.badge-sky {
  background: rgba(80, 160, 255, 0.2);
  color: var(--sky-400);
}

.badge-avalon {
  background: rgba(102, 102, 171, 0.2);
  color: var(--avalon-300);
}

/* Bucket badges */
/* Bucket badges (outline, theme-light friendly) */
.badge-preservacao {
  background: var(--bucket-preservacao);
  border: 1px solid var(--bucket-preservacao);
  color: #ffffff;
}

.badge-manutencao {
  background: #ffffff;
  border: 1px solid var(--avalon-900);
  color: var(--avalon-900);
}

.badge-ganho {
  background: var(--bucket-ganho);
  border: 1px solid var(--bucket-ganho);
  color: #ffffff;
}

/* ═══════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════ */

.table-container {
  overflow-x: auto;
  border: 1px solid rgba(80, 160, 255, 0.15);
  border-radius: var(--radius-lg);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

thead {
  background: rgba(80, 160, 255, 0.08);
}

th {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--avalon-400);
  text-align: left;
  border-bottom: 1px solid rgba(80, 160, 255, 0.15);
}

td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--avalon-200);
  border-bottom: 1px solid rgba(80, 160, 255, 0.08);
}

tbody tr:hover {
  background: rgba(80, 160, 255, 0.05);
}

tbody tr:last-child td {
  border-bottom: none;
}

.text-right { text-align: right; }
.text-center { text-align: center; }

/* ═══════════════════════════════════════════════════════════════
   BUCKET VISUALIZATION (Chhabra Framework)
   ═══════════════════════════════════════════════════════════════ */

.bucket-bar {
  display: flex;
  height: 24px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(80, 160, 255, 0.1);
}

.theme-light .bucket-bar {
  background: #f1f5f9; /* slate-100 */
}

.bucket-segment {
  height: 100%;
  transition: width var(--transition-base);
}

.bucket-preservacao { background: var(--bucket-preservacao); }
.bucket-manutencao { background: var(--bucket-manutencao); }
.bucket-ganho { background: var(--bucket-ganho); }

.bucket-legend {
  display: flex;
  gap: var(--space-6);
  margin-top: var(--space-4);
}

.bucket-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.bucket-legend-color {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-sm);
}

.bucket-legend-label {
  font-size: var(--text-sm);
  color: var(--avalon-400);
}

.bucket-legend-value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: white;
  margin-left: var(--space-1);
}

/* Type badges (product categories) */
.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid currentColor;
  background: transparent;
}
.type-dot { width: 8px; height: 8px; border-radius: var(--radius-full); background: currentColor; }
.type-renda-fixa { color: var(--product-renda-fixa); }
.type-fundos { color: var(--product-fundos); }
.type-alternativos { color: var(--product-alternativos); }
.type-caixa { color: var(--product-caixa); }

/* ═══════════════════════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════════════════════ */

.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid rgba(80, 160, 255, 0.15);
  margin-bottom: var(--space-6);
}

.tab {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--avalon-400);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab:hover {
  color: var(--avalon-200);
}

.tab.active {
  color: white;
  border-bottom-color: var(--sky-500);
}

/* Light theme tab overrides */
.theme-light .tabs { border-bottom: 1px solid #e5e7eb; }
.theme-light .tab {
  color: var(--gray-600);
}
.theme-light .tab:hover {
  color: var(--gray-800);
}
.theme-light .tab.active {
  color: #0F172A !important;
  border-bottom-color: #0F172A;
}
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn var(--transition-base);
}

/* ═══════════════════════════════════════════════════════════════
   CHARTS
   ═══════════════════════════════════════════════════════════════ */

.chart-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: rgba(0, 0, 69, 0.5);
  border: 1px solid rgba(80, 160, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.chart-container-square {
  aspect-ratio: 1;
}

/* Compact chart variant for small, sober visuals */
.chart-container-compact {
  max-width: 340px;
  width: 100%;
  margin: 0 auto;
}

/* Split layout for chart + details */
.chart-split {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--space-6);
  align-items: center;
}

@media (max-width: 768px) {
  .chart-split { grid-template-columns: 1fr; }
}

.bucket-details { display: flex; flex-direction: column; gap: var(--space-4); }
.bucket-item { display: flex; justify-content: space-between; align-items: center; }
.bucket-left { display: flex; align-items: center; gap: var(--space-3); }
.bucket-dot { width: 10px; height: 10px; border-radius: var(--radius-full); }
.bucket-label { font-size: var(--text-sm); }
.bucket-right { text-align: right; }
.bucket-pct { font-weight: 600; }
.bucket-value { font-size: var(--text-sm); color: var(--gray-600); }

.theme-light .bucket-label { color: var(--gray-700); }
.theme-light .bucket-pct { color: var(--gray-800); }
.theme-light .bucket-value { color: var(--gray-600); }

/* ═══════════════════════════════════════════════════════════════
   GRAFISMO PATTERN (inspired by logo "O" arc)
   ═══════════════════════════════════════════════════════════════ */

.grafismo {
  position: relative;
}

.grafismo::before {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  border: 4px solid var(--sky-500);
  border-radius: 50%;
  opacity: 0.1;
  clip-path: polygon(0 0, 100% 0, 100% 75%, 0 75%);
}

/* Arco decorativo */
.arc-decoration {
  position: absolute;
  width: 150px;
  height: 150px;
  border: 3px solid var(--sky-500);
  border-radius: 50%;
  opacity: 0.15;
  clip-path: polygon(15% 0, 85% 0, 100% 50%, 85% 100%, 15% 100%, 0 50%);
}

/* ═══════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */

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

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

@keyframes arcPulse {
  0%, 100% { opacity: 0.1; }
  50% { opacity: 0.2; }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease forwards;
}

.animate-slide-up {
  animation: slideInUp 0.6s ease forwards;
}

/* Staggered Animation */
.stagger > * {
  opacity: 0;
  animation: slideInUp 0.5s ease forwards;
}

.stagger > *:nth-child(1) { animation-delay: 0.1s; }
.stagger > *:nth-child(2) { animation-delay: 0.2s; }
.stagger > *:nth-child(3) { animation-delay: 0.3s; }
.stagger > *:nth-child(4) { animation-delay: 0.4s; }
.stagger > *:nth-child(5) { animation-delay: 0.5s; }
.stagger > *:nth-child(6) { animation-delay: 0.6s; }

/* ═══════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════ */

.footer {
  margin-top: var(--space-16);
  padding: var(--space-8) 0;
  border-top: 1px solid rgba(80, 160, 255, 0.15);
  background: rgba(0, 0, 46, 0.5);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-text {
  font-size: var(--text-sm);
  color: var(--avalon-400);
}

.footer-links {
  display: flex;
  gap: var(--space-6);
}

.footer-link {
  font-size: var(--text-sm);
  color: var(--avalon-400);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--sky-400);
}

/* Footer — light theme overrides */
.theme-light .footer {
  background: #ffffff;
  border-top: 1px solid #e5e7eb; /* slate-200 */
}
.theme-light .footer-text {
  color: var(--gray-600);
}
.theme-light .footer-link {
  color: var(--gray-600);
}
.theme-light .footer-link:hover {
  color: #0F172A; /* Deep Navy */
}

/* ═══════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════ */

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.text-sky { color: var(--sky-500); }
.text-success { color: var(--success-500); }
.text-danger { color: var(--danger-500); }
.text-warning { color: var(--warning-500); }
.text-muted { color: var(--avalon-400); }

.hidden { display: none; }
.block { display: block; }

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--avalon-800);
}

::-webkit-scrollbar-thumb {
  background: var(--avalon-500);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--sky-600);
}

/* Selection */
::selection {
  background: rgba(80, 160, 255, 0.3);
  color: white;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .hide-mobile { display: none; }

  .page-title {
    font-size: var(--text-3xl);
    letter-spacing: 0.05em;
  }

  .stat-value {
    font-size: var(--text-2xl);
  }

  .header-inner {
    height: 64px;
  }

  .nav {
    gap: var(--space-4);
  }
}
/* ═══════════════════════════════════════════════════════════════
   THEME: ALT (test variant keeping Avalon ID)
   ═══════════════════════════════════════════════════════════════ */
.theme-alt {
  /* Remap bucket (layers) to alternate Avalon tokens */
  --bucket-preservacao: var(--avalon-900); /* Deep navy for safety */
  --bucket-manutencao: #E6E6F1;            /* Branco gelo */
  --bucket-ganho: var(--sky-500);          /* Sky for growth */
}

/* Theme ALT2: Navy scale emphasis (softer accent) */
.theme-alt2 {
  /* Layers */
  --bucket-preservacao: var(--avalon-700);
  --bucket-manutencao: #E6E6F1;
  --bucket-ganho: var(--sky-400);

  /* Composition */
  --comp-renda-fixa: var(--avalon-700);
  --comp-fundos: var(--avalon-500);
  --comp-alternativos: var(--avalon-400);
  --comp-caixa: var(--sky-400);
}

/* Theme ALT3: Deep navy for safety, gold for growth accent */
.theme-alt3 {
  /* Layers */
  --bucket-preservacao: var(--avalon-900);
  --bucket-manutencao: #E6E6F1;
  --bucket-ganho: var(--gold-500);

  /* Composition */
  --comp-renda-fixa: var(--avalon-900);
  --comp-fundos: var(--avalon-700);
  --comp-alternativos: var(--avalon-500);
  --comp-caixa: var(--gold-500);
}

/* ═══════════════════════════════════════════════════════════════
   SIMULAÇÕES PAGE STYLES
   ═══════════════════════════════════════════════════════════════ */

/* Form Elements */
.form-label {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-label-text {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-700);
}

.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  font-family: var(--font-body);
  font-size: var(--text-base);
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--avalon-500);
  box-shadow: 0 0 0 3px rgba(0, 0, 115, 0.1);
}

.form-input-sm {
  padding: 0.5rem 0.75rem;
  font-size: var(--text-sm);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--gray-500);
  margin-top: 0.25rem;
}

.form-label-inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.form-label-inline .form-label-text {
  white-space: nowrap;
}

/* Scenario Cards */
.scenario-card {
  padding: 1.25rem;
  border-radius: 0.75rem;
  background: var(--gray-50);
  border: 2px solid var(--gray-200);
}

.scenario-card.scenario-1 {
  border-color: var(--avalon-900);
}

.scenario-card.scenario-2 {
  border-color: #B8860B;
}

.scenario-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 1rem;
}

.scenario-line {
  display: inline-block;
  width: 2rem;
  height: 3px;
  border-radius: 2px;
}

.scenario-line-1 {
  background: var(--avalon-900);
}

.scenario-line-2 {
  background: #B8860B;
}

.scenario-fields {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.scenario-info {
  padding: 0.75rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  font-size: var(--text-sm);
  color: var(--gray-700);
}

/* Info Card */
.card-info {
  background: linear-gradient(135deg, rgba(0, 0, 115, 0.03), rgba(80, 160, 255, 0.05));
  border-left: 4px solid var(--avalon-500);
}

.method-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.method-list li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
  font-size: var(--text-sm);
  color: var(--gray-700);
}

.method-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--avalon-500);
  font-weight: bold;
}

.method-list li strong {
  color: var(--avalon-900);
}

/* Event Controls */
.evt-controls {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.evt-list {
  font-size: var(--text-sm);
  color: var(--gray-600);
}

.evt-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  margin: 0.25rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  font-size: var(--text-sm);
}

.evt-remove {
  background: none;
  border: none;
  color: var(--danger-500);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.evt-remove:hover {
  color: var(--danger-400);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--avalon-900);
  color: #fff;
}

.btn-primary:hover {
  background: var(--avalon-800);
}

.btn-danger {
  background: var(--danger-500);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger-400);
}

/* Chart Toggles */
.chart-toggles {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  color: var(--gray-700);
  cursor: pointer;
}

.toggle-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--avalon-900);
}

/* Chart Wrapper */
.chart-wrapper {
  position: relative;
  width: 100%;
}

.chart-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-caption {
  font-size: var(--text-sm);
  color: var(--gray-500);
  margin-top: 1rem;
  text-align: center;
}

/* Event Sections (Saques/Aportes) */
.evt-section {
  margin-bottom: 1.5rem;
}

.evt-section:last-child {
  margin-bottom: 0;
}

.evt-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.evt-section-title {
  font-size: var(--text-base);
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.evt-section-title::before {
  content: '';
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
}

.evt-section-saques::before {
  background: var(--danger-500);
}

.evt-section-aportes::before {
  background: var(--success-500);
}

.evt-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 1.5rem 0;
}

/* Event Tags */
.evt-tag-saque {
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(220, 38, 38, 0.05);
}

.evt-tag-aporte {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.05);
}

/* Button Variants */
.btn-danger-outline {
  background: transparent;
  color: var(--danger-500);
  border: 1px solid var(--danger-500);
}

.btn-danger-outline:hover {
  background: var(--danger-500);
  color: #fff;
}

.btn-success-outline {
  background: transparent;
  color: var(--success-500);
  border: 1px solid var(--success-500);
}

.btn-success-outline:hover {
  background: var(--success-500);
  color: #fff;
}

.btn-muted {
  background: var(--gray-100);
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
}

.btn-muted:hover {
  background: var(--gray-200);
  color: var(--gray-700);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: var(--text-xs);
}
