/* ==========================================================================
   WINGENE INVESTIMENTOS PWA — DESIGN SYSTEM & STYLESHEET (INLINE EDITING)
   ========================================================================== */

:root {
  --bg-dark: #0f0f13;
  --bg-card: #18181f;
  --bg-card-hover: #22222c;
  --bg-glass: rgba(255, 255, 255, 0.05);
  
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --border-light: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(16, 64, 176, 0.5);

  /* Paleta WinGene */
  --primary-red: #b01010;
  --primary-blue: #1040b0;
  --primary-green: #10b981;
  --primary-gold: #f59e0b;
  
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: 60px;
}

/* Fundo estelar sutil */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 20% 20%, rgba(16, 64, 176, 0.15) 0%, transparent 40%),
              radial-gradient(circle at 80% 80%, rgba(176, 16, 16, 0.12) 0%, transparent 40%);
  pointer-events: none;
  z-index: -1;
}

/* --- HEADER & TOP NAVBAR --- */
.app-header {
  background: rgba(15, 15, 19, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 0;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
}

.btn-hamburger {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  flex-shrink: 0;
}

.btn-hamburger:hover,
.btn-hamburger:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: scale(1.04);
}

.brand-logo-img {
  width: 40px;
  height: 40px;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 0%, #d1d5db 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: #3b82f6;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --- MENU GAVETA OFF-CANVAS (MENU SANDUÍCHE) --- */
.nav-drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.nav-drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 300px;
  max-width: 85vw;
  height: 100vh;
  background: #14141a;
  border-right: 1px solid var(--border-light);
  z-index: 450;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 12px 0 36px rgba(0, 0, 0, 0.6);
}

.nav-drawer.is-open {
  transform: translateX(0);
}

.nav-drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-drawer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-drawer-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
}

.nav-drawer-close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-drawer-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.nav-drawer-body {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-drawer-section-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 12px 4px 12px;
  font-weight: 700;
}

.nav-drawer-item.tab-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #d1d5db;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
}

.nav-drawer-item.tab-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  transform: translateX(2px);
}

.nav-item-icon,
.title-icon,
.row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  color: var(--text-muted);
  transition: color 0.18s ease;
}

.title-icon,
.row-icon {
  margin-right: 6px;
}

.nav-drawer-item.tab-btn:hover .nav-item-icon {
  color: #ffffff;
}

.nav-drawer-item.tab-btn.active {
  background: linear-gradient(135deg, rgba(16, 64, 176, 0.35) 0%, rgba(16, 64, 176, 0.18) 100%);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 4px 12px rgba(16, 64, 176, 0.2);
}

.nav-drawer-item.tab-btn.active .nav-item-icon {
  color: #60a5fa;
}

.nav-drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
  text-align: center;
}

/* --- MAIN LAYOUT & CONTAINER --- */
.app-container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 16px;
}

/* Tab Panes */
.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

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

/* --- CARDS & GRID --- */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.25);
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.stat-card.primary::before { background: var(--primary-blue); }
.stat-card.green::before { background: var(--primary-green); }
.stat-card.gold::before { background: var(--primary-gold); }

.stat-label {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.stat-subvalue {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Card Genérico */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  margin-bottom: 20px;
}

.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
}

/* --- INLINE ADD BAR & INLINE EDITING --- */
.inline-add-bar {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 14px;
}

.inline-add-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.5fr 1.8fr 1.2fr 1.2fr 1.2fr;
  gap: 10px;
}

.inline-add-grid-acoes {
  display: grid;
  grid-template-columns: 1.2fr 1.8fr 1fr 1.2fr 1fr 1.4fr;
  gap: 10px;
}

@media (max-width: 900px) {
  .inline-add-grid,
  .inline-add-grid-acoes {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 550px) {
  .inline-add-grid,
  .inline-add-grid-acoes {
    grid-template-columns: 1fr;
  }
}

.table-input-sm {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--primary-blue);
  border-radius: 6px;
  padding: 4px 8px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.88rem;
}

.table-input-sm:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--border-focus);
}

tr.row-editing {
  background: rgba(16, 64, 176, 0.15) !important;
}

tr.row-editing td {
  padding: 6px 8px !important;
}

/* --- TABELAS RESPONSIVAS --- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border-light);
}

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

.data-table th {
  background: rgba(255, 255, 255, 0.03);
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges e Tickers */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-rf { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-info { background: rgba(16, 64, 176, 0.2); color: #60a5fa; }

.ticker-badge {
  display: inline-flex;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  border-left: 4px solid var(--primary-blue);
  font-family: var(--font-heading);
}

.taxa-tag {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.82rem;
}

.pct-pill {
  background: rgba(16, 64, 176, 0.18);
  color: #93c5fd;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.meta-pill {
  background: rgba(245, 158, 11, 0.15);
  color: #fde047;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 600;
}

/* --- REBALANCEAMENTO & METAS --- */
.card-rebalance {
  transition: transform 0.2s ease;
}

.rebalance-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.rebalance-bars .bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.progress-container {
  height: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}

.progress-bar.current {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}

.progress-marker {
  position: absolute;
  top: 0;
  width: 3px;
  height: 100%;
  background: #ffffff;
  box-shadow: 0 0 8px #ffffff;
  z-index: 2;
}

/* --- BOTÕES & INPUTS --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 9px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
  border-radius: 8px;
}

.btn-primary {
  background: var(--primary-blue);
  color: #ffffff;
}

.btn-primary:hover {
  background: #0d3494;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: var(--border-light);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-icon {
  background: transparent;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-icon.danger:hover {
  background: rgba(176, 16, 16, 0.2);
}

.btn-icon.success:hover {
  background: rgba(16, 185, 129, 0.2);
}

/* Form inputs */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
}

.form-control-sm {
  padding: 6px 10px;
  font-size: 0.88rem;
  border-radius: 8px;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px var(--border-focus);
}

/* --- GRÁFICOS DONUT SVG --- */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.donut-chart-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.donut-svg {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-label {
  flex-grow: 1;
  color: var(--text-muted);
}

.legend-value {
  font-weight: 600;
}

/* --- USER AVATAR & DROPDOWN MENU --- */
.user-profile-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.user-avatar-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  background: var(--bg-card);
  padding: 0;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

.user-avatar-btn:hover,
.user-avatar-btn:focus-visible {
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(16, 64, 176, 0.3);
}

.user-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.user-avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
}

/* Badge no canto do avatar */
.avatar-status-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--bg-dark);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.avatar-status-badge.is-success {
  background-color: #10b981;
}

.avatar-status-badge.is-error {
  background-color: #ef4444;
}

.avatar-status-badge.is-syncing {
  background-color: #3b82f6;
  width: 16px;
  height: 16px;
  bottom: -3px;
  right: -3px;
}

.avatar-status-badge .sync-spin-icon {
  display: none;
  width: 10px;
  height: 10px;
  color: #ffffff;
}

.avatar-status-badge.is-syncing .sync-spin-icon {
  display: block;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Menu Dropdown */
.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: #18181f;
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 10px;
  z-index: 250;
  animation: dropdownFadeIn 0.18s ease-out;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.user-dropdown-header {
  padding: 8px 10px;
}

.user-dropdown-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.2;
}

.user-dropdown-email {
  font-size: 0.8rem;
  color: var(--text-muted);
  word-break: break-all;
  margin-top: 2px;
}

.user-dropdown-status {
  margin-top: 8px;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 8px;
  display: inline-block;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

.user-dropdown-status.success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.user-dropdown-status.error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.user-dropdown-status.syncing {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.3);
}

.user-dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: 6px 0;
}

.user-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  color: #d1d5db;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.user-dropdown-item:hover,
.user-dropdown-item:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.user-dropdown-item.danger {
  color: #f87171;
}

.user-dropdown-item.danger:hover,
.user-dropdown-item.danger:focus-visible {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1f2937;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 300;
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

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

/* --- MODAL DIALOG HISTÓRICO DE ATIVOS --- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  background: #18181f;
  border: 1px solid var(--border-light);
  border-radius: 16px;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

.history-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.history-val {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-main);
}

.toast-success { border-left: 4px solid var(--primary-green); }
.toast-error { border-left: 4px solid var(--primary-red); }

/* --- ESTILOS DE EVOLUÇÃO (MENSAL E ANUAL) --- */
.evol-positive {
  color: #34d399;
  font-weight: 600;
}

.evol-negative {
  color: #f87171;
  font-weight: 600;
}

.evol-pill-positive {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.evol-pill-negative {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* --- RESPONSIVIDADE UTILS & MEDIA QUERIES --- */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 0.8rem; }
.m-0 { margin: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-1 { margin-top: 4px; }
.mt-3 { margin-top: 12px; }
.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-5 { padding-top: 2.5rem; padding-bottom: 2.5rem; }

/* ==========================================================================
   OTIMIZAÇÕES RESPONSIVAS PARA DISPOSITIVOS MÓVEIS (SMARTPHONES E TABLETS)
   ========================================================================== */

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

@media (max-width: 768px) {
  .app-header {
    padding: 10px 0;
  }

  .header-container {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .brand-area {
    justify-content: flex-start;
    width: auto;
  }

  .header-actions {
    justify-content: flex-end;
    align-items: center;
    width: auto;
    gap: 8px;
    margin-left: auto;
  }

  .user-email-badge {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-container {
    margin: 12px auto;
    padding: 0 10px;
  }

  .grid-stats {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }

  .donut-chart-wrapper {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .donut-legend {
    width: 100%;
  }

  .inline-add-bar {
    padding: 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
  }

  .inline-add-grid,
  .inline-add-grid-acoes {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .data-table {
    min-width: 680px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 8px;
    font-size: 0.82rem;
  }

  .table-input-sm {
    font-size: 0.88rem;
    padding: 8px 10px;
    min-height: 38px;
  }

  .btn-icon {
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .btn {
    padding: 10px 16px;
    font-size: 0.88rem;
    min-height: 42px;
  }

  .btn-sm {
    padding: 8px 12px;
    font-size: 0.82rem;
    min-height: 38px;
  }
}

@media (max-width: 480px) {
  .brand-logo-img {
    width: 36px;
    height: 36px;
  }

  .brand-title {
    font-size: 1.15rem;
  }

  .brand-subtitle {
    font-size: 0.68rem;
  }

  .user-avatar-btn {
    width: 36px;
    height: 36px;
  }

  .tab-navigation {
    padding: 4px;
    gap: 4px;
    border-radius: 10px;
  }

  .tab-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .card {
    padding: 14px;
    border-radius: 12px;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    text-align: center;
    font-size: 0.82rem;
  }
}
