/**
 * Tema escuro estilo mesa (XP-like) — Invest / Datameros
 * Tokens padrão (alinhados a APP_* em constants.php); auth_header injeta --color-accent etc. quando necessário.
 */

:root {
  --color-accent: #6D28D9;
  --color-accent-soft: rgba(109, 40, 217, 0.35);
  --color-bg-deep: #0a0a0b;
  --color-surface: #141416;
  --color-surface-2: #1c1c1f;
  --color-border: #2a2a2e;
  --color-text: #f4f4f5;
  --color-text-muted: #a1a1aa;
  --invest-sidebar-width: 6.75rem;
  --invest-mobile-nav-h: 4.5rem;
}

/* Botão roxo (accent) em qualquer página; não depende de body.theme-dark */
.btn-invest-accent {
  background: var(--color-accent);
  border: 1px solid var(--color-accent);
  color: #fff !important;
  font-weight: 600;
}
.btn-invest-accent:hover {
  filter: brightness(1.08);
  color: #fff !important;
  border-color: var(--color-accent);
}

/* Variante apagada para ações secundárias (Sair, Cancelar) — roxo desbotado */
.btn-invest-muted {
  background: rgba(109, 40, 217, 0.18);
  border: 1px solid rgba(109, 40, 217, 0.35);
  color: #c4b5fd !important;
  font-weight: 600;
}
.btn-invest-muted:hover,
.btn-invest-muted:focus {
  background: rgba(109, 40, 217, 0.28);
  color: #fff !important;
  border-color: var(--color-accent);
}

/* ---------- App logado ---------- */
body.theme-dark {
  background-color: var(--color-bg-deep) !important;
  color: var(--color-text);
}

/* main.css usa #contentzoom { transform: scale(0.8) } — ID vence body.theme-dark .contentzoom;
   Ancestral com transform quebra position:fixed do menu inferior no mobile. */
body.theme-dark #contentzoom {
  transform: none !important;
  transform-origin: 0 0 !important;
}

body.theme-dark #wrapper,
body.theme-dark #content-wrapper {
  background-color: var(--color-bg-deep) !important;
}

body.theme-dark #content {
  background-color: var(--color-bg-deep) !important;
}

/* Títulos de seção no dashboard (Patrimônio / Proventos) */
body.theme-dark #div_dashboard .dashboard-section-title {
  color: var(--color-text) !important;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-left: 3px solid var(--color-accent);
  padding-left: 0.65rem;
  margin-bottom: 0.25rem;
}

/* Filtro global — destaque na cor principal (evita azul padrão do Bootstrap) */
body.theme-dark #div_dashboard .dashboard-visao-carteira.border-left-info {
  border-left-color: var(--color-accent) !important;
}

body.theme-dark #div_dashboard .dashboard-visao-carteira__titulo.text-info {
  color: var(--color-accent) !important;
}

body.theme-dark #div_dashboard .dashboard-visao-carteira .btn-outline-primary {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

body.theme-dark #div_dashboard .dashboard-visao-carteira .btn-outline-primary:hover {
  background: rgba(109, 40, 217, 0.2);
  color: #fff;
  border-color: var(--color-accent);
}

body.theme-dark #div_dashboard .dashboard-visao-carteira .btn-outline-primary.active {
  background: var(--color-accent) !important;
  border-color: var(--color-accent) !important;
  color: #fff !important;
}

/* Composição: rosca com altura fixa + barras complementares */
#div_dashboard .dashboard-composicao-doughnut-wrap {
  position: relative;
  width: 100%;
  max-width: 300px;
  height: 280px;
  margin-left: auto;
  margin-right: auto;
}

#div_dashboard .dashboard-composicao-doughnut-wrap > canvas {
  display: block;
  max-width: 100%;
}

@media (min-width: 992px) {
  #div_dashboard .dashboard-composicao-doughnut-wrap {
    max-width: none;
    height: 300px;
  }
}

#div_dashboard .dashboard-composicao-barras-wrap {
  position: relative;
  width: 100%;
  min-height: 160px;
}

#div_dashboard .dashboard-composicao-barras-wrap > canvas {
  display: block;
  max-width: 100%;
}

/* Chart.js horizontalBar: pai com altura limitada evita resize infinito (maintainAspectRatio: false) */
#div_dashboard .dashboard-hbar-chart-wrap {
  position: relative;
  width: 100%;
  max-height: min(520px, 70vh);
  overflow: hidden;
}

#div_dashboard .dashboard-hbar-chart-wrap > canvas {
  display: block;
  max-width: 100%;
}

/* Barras horizontais com lista longa: ~10 categorias visíveis, restante com scroll */
#div_dashboard .dashboard-hbar-chart-scroll {
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  border-radius: 0.35rem;
}

/* Linha com 3 cards (corretora / variação categoria / ativo): área do gráfico sem teto fixo — scroll interno */
#div_dashboard .dashboard-pat-triple-row .dashboard-hbar-chart-scroll {
  max-height: none;
}

/* DY — três cards na mesma linha: scroll interno sem teto global */
#div_dashboard .dashboard-dy-triple-row .dashboard-hbar-chart-scroll {
  max-height: none;
}

/* Proventos — linha tripla; “Dividendos por categoria” define altura via style inline (~6 barras + scroll interno). */
#div_dashboard .dashboard-prov-triple-row .dashboard-hbar-chart-scroll {
  max-height: none;
}

/* Top ativos: janela menor + scroll para não esticar o card */
#div_dashboard .dashboard-hbar-chart-scroll.dashboard-hbar-chart-scroll--top-ativos {
  max-height: 260px;
}

#div_dashboard .dashboard-hbar-chart-scroll-inner {
  position: relative;
  width: 100%;
}

#div_dashboard .dashboard-hbar-chart-scroll-inner > canvas {
  display: block;
  max-width: 100%;
}

/* Frequência de aporte: barras verticais (altura fixa evita resize infinito com maintainAspectRatio: false) */
#div_dashboard .dashboard-chart-freq-aporte {
  position: relative;
  width: 100%;
  height: 400px;
  max-height: 52vh;
}

#div_dashboard .dashboard-chart-freq-aporte > canvas {
  display: block;
  max-width: 100%;
}

body.theme-dark .cl-padrao {
  background-color: var(--color-surface) !important;
  color: var(--color-text);
}

body.theme-dark .text-padrao {
  color: var(--color-text) !important;
}

body.theme-dark .btn-padrao {
  background: var(--color-accent) !important;
  border-color: var(--color-accent) !important;
  color: #fff !important;
}

body.theme-dark .navbar.cl-padrao,
body.theme-dark nav.navbar {
  background-color: var(--color-surface) !important;
  border-bottom: 1px solid var(--color-border);
}

/* Remove barra superior global do app (desktop + mobile) */
body.theme-dark nav.navbar.cl-padrao.static-top {
  display: none !important;
}

body.theme-dark .sidenav:not(.invest-app-sidebar),
body.theme-dark .sidebarfundo {
  background-color: var(--color-surface-2) !important;
  border-right: 1px solid var(--color-border);
}

body.theme-dark .sidebar-padrao .nav-item .nav-link {
  color: rgba(244, 244, 245, 0.88) !important;
}

body.theme-dark .sidebar-padrao .nav-item .nav-link:hover {
  color: #fff !important;
  background: rgba(109, 40, 217, 0.12);
}

/* Marca lateral */
body.theme-dark .sidebar-brand-datameros {
  color: var(--color-text) !important;
  border-bottom: 1px solid var(--color-border);
  min-height: 3.5rem;
}

body.theme-dark .sidebar-brand-datameros__text {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

/* Alinha ícone + texto + chevron no menu */
@media (min-width: 768px) {
  body.theme-dark .sidebar-padrao .nav-item .nav-link {
    display: flex !important;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.65rem;
  }

  body.theme-dark .sidebar-padrao .nav-item .nav-link i {
    margin-right: 0 !important;
    line-height: 1;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
  }

  body.theme-dark .sidebar-padrao .nav-item .nav-link span {
    flex: 1 1 auto;
    line-height: 1.35;
  }

  body.theme-dark .sidebar-padrao .nav-item .nav-link[data-toggle="collapse"]::after {
    float: none !important;
    margin-left: auto;
    align-self: center;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

body.theme-dark .sidebar-padrao .sidebar-heading {
  color: var(--color-text-muted) !important;
}

/* Submenu (collapse) integrado ao tema escuro */
body.theme-dark .sidebar-padrao .sidebar-submenu-inner {
  background-color: var(--color-surface) !important;
  border: 1px solid var(--color-border);
  box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.35);
}

body.theme-dark .sidebar-padrao .sidebar-submenu-inner .collapse-header {
  color: var(--color-text-muted) !important;
}

body.theme-dark .sidebar-padrao .sidebar-submenu-inner .collapse-item {
  color: rgba(244, 244, 245, 0.9) !important;
}

body.theme-dark .sidebar-padrao .sidebar-submenu-inner .collapse-item:hover {
  background-color: rgba(109, 40, 217, 0.14) !important;
  color: var(--color-text) !important;
}

body.theme-dark .sidebar-padrao .sidebar-submenu-inner .collapse-item:active {
  background-color: rgba(109, 40, 217, 0.22) !important;
}

body.theme-dark .sidebar-padrao .sidebar-submenu-inner .collapse-item.active {
  color: #c4b5fd !important;
  font-weight: 700;
}

/* Verde dos botões Bootstrap menos saturado no tema escuro */
body.theme-dark .btn-success {
  background-color: #3d6b58 !important;
  border-color: #355f4e !important;
  color: #fff !important;
}

body.theme-dark .btn-success:hover,
body.theme-dark .btn-success:focus {
  filter: brightness(1.07);
  color: #fff !important;
}

/* Situação na tabela Ativos a receber (substitui verde neon inline) */
body.theme-dark .cell-situacao {
  font-weight: 600;
  white-space: nowrap;
}

body.theme-dark .cell-situacao--recebido {
  background-color: rgba(61, 107, 88, 0.42) !important;
  color: #c8ebe0 !important;
}

body.theme-dark .cell-situacao--pendente {
  background-color: rgba(161, 98, 7, 0.22) !important;
  color: #fcd34d !important;
}

body.theme-dark .card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

body.theme-dark .card-header {
  background-color: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

body.theme-dark .table {
  color: var(--color-text);
}

body.theme-dark .table thead th {
  border-bottom-color: var(--color-border);
  color: var(--color-text-muted);
}

body.theme-dark .table td,
body.theme-dark .table th {
  border-color: var(--color-border);
}

body.theme-dark .form-control {
  background-color: var(--color-surface-2);
  border-color: var(--color-border);
  color: var(--color-text);
}

body.theme-dark .form-control:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 0.15rem var(--color-accent-soft);
  background-color: var(--color-surface-2);
  color: var(--color-text);
}

body.theme-dark .modal-content {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

body.theme-dark .modal-header,
body.theme-dark .modal-footer {
  border-color: var(--color-border);
}

body.theme-dark .dropdown-menu {
  background-color: var(--color-surface-2);
  border: 1px solid var(--color-border);
}

body.theme-dark .dropdown-item {
  color: var(--color-text);
}

body.theme-dark .dropdown-item:hover {
  background-color: rgba(109, 40, 217, 0.15);
  color: #fff;
}

body.theme-dark .border-left-primary,
body.theme-dark .border-left-success,
body.theme-dark .border-left-info {
  border-color: var(--color-border) !important;
}

/* Stripe lateral dos cards (SB Admin usa .border-left-danger como azul primário) */
body.theme-dark .border-left-danger {
  border-left-color: var(--color-accent) !important;
}

/* Títulos de card: mesmo template usa .text-danger como destaque azul — alinha à cor principal */
body.theme-dark .card-header .text-danger {
  color: var(--color-accent) !important;
}

body.theme-dark .text-gray-800,
body.theme-dark .text-gray-700 {
  color: var(--color-text) !important;
}

body.theme-dark .text-gray-600,
body.theme-dark .text-gray-500 {
  color: var(--color-text-muted) !important;
}

body.theme-dark .shadow,
body.theme-dark .card.shadow {
  box-shadow: 0 0.15rem 1.75rem 0 rgba(0, 0, 0, 0.45) !important;
}

/* DataTables */
body.theme-dark .dataTables_wrapper .dataTables_length,
body.theme-dark .dataTables_wrapper .dataTables_filter,
body.theme-dark .dataTables_wrapper .dataTables_info,
body.theme-dark .dataTables_wrapper .dataTables_paginate {
  color: var(--color-text-muted);
}

body.theme-dark table.dataTable tbody tr {
  background-color: var(--color-surface);
}

body.theme-dark table.dataTable.stripe tbody tr.odd,
body.theme-dark table.dataTable.display tbody tr.odd {
  background-color: var(--color-surface-2);
}

/* Paginação DataTables — mesmo cinza do submenu (.sidebar-submenu-inner) */
body.theme-dark .dataTables_wrapper .dataTables_paginate .pagination {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
}

body.theme-dark .dataTables_wrapper .dataTables_paginate .page-link {
  background-color: var(--color-surface) !important;
  border-color: var(--color-border) !important;
  color: var(--color-accent) !important;
}

body.theme-dark .dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
  background-color: var(--color-accent) !important;
  border-color: var(--color-accent) !important;
  color: #fff !important;
}

body.theme-dark .dataTables_wrapper .dataTables_paginate .page-link:hover {
  background-color: var(--color-surface-2) !important;
  border-color: var(--color-border) !important;
  color: #c4b5fd !important;
}

body.theme-dark .dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link {
  background-color: var(--color-surface) !important;
  border-color: var(--color-border) !important;
  color: var(--color-text-muted) !important;
}

/* ---------- Fluxos de autenticação ---------- */
body.theme-auth.theme-dark {
  min-height: 100vh;
}

.theme-auth .auth-page {
  min-height: 100vh;
  background: var(--color-bg-deep);
}

.theme-auth .auth-page__row {
  min-height: 100vh;
}

@media (min-width: 992px) {
  .theme-auth .auth-page__form-col {
    min-height: 100vh;
  }

  .theme-auth .auth-page__hero {
    min-height: 100vh;
  }
}

.theme-auth .auth-page__form-col {
  background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-bg-deep) 100%);
  border-right: 1px solid var(--color-border);
}

.theme-auth .auth-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 2rem 2rem 2.25rem;
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.45);
}

.theme-auth .auth-brand {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--color-text);
}

.theme-auth .auth-brand--login {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  flex-wrap: nowrap;
  text-align: left;
}

.theme-auth .auth-brand__icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(109, 40, 217, 0.38);
}

.theme-auth .auth-brand__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.theme-auth .auth-brand__title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: var(--color-text);
}

.theme-auth .auth-brand__vendor-mark {
  display: block;
  margin-top: 0.35rem;
  max-width: 200px;
  width: 100%;
  height: auto;
}

.theme-auth .auth-brand__vendor-fallback {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: rgba(244, 244, 245, 0.92);
}

.theme-auth .auth-brand__tagline {
  margin-top: 0.65rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.theme-auth .auth-brand small {
  font-weight: 500;
  color: var(--color-text-muted);
}

.theme-auth .auth-brand .fa-chart-line {
  color: var(--color-accent);
}

.theme-auth .form-control {
  background: var(--color-bg-deep);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
}

.theme-auth .form-control:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 0.2rem var(--color-accent-soft);
}

.theme-auth .btn-auth-primary {
  background: var(--color-accent);
  border: none;
  color: #fff;
  font-weight: 600;
  border-radius: 8px;
  padding: 0.65rem 1rem;
}

.theme-auth .btn-auth-primary:hover {
  filter: brightness(1.08);
  color: #fff;
}

.theme-auth .btn-auth-secondary {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-weight: 600;
  border-radius: 8px;
  padding: 0.65rem 1rem;
}

.theme-auth .btn-auth-secondary:hover {
  border-color: var(--color-accent);
  color: var(--color-text);
}

.theme-auth .auth-page__hero {
  position: relative;
  min-height: 100vh;
  background-color: var(--color-bg-deep);
  background-image:
    linear-gradient(135deg, rgba(109, 40, 217, 0.32) 0%, transparent 50%),
    radial-gradient(circle at 72% 18%, rgba(109, 40, 217, 0.18), transparent 52%),
    linear-gradient(180deg, #12121a 0%, var(--color-bg-deep) 100%);
  background-size: cover;
  background-position: center;
}

/* Se existir assets/img/auth/login-hero.jpg, a view pode definir background-image inline por cima deste gradiente. */

.theme-auth .auth-page__hero-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 3rem;
  background: linear-gradient(0deg, rgba(10, 10, 11, 0.92) 0%, transparent 55%);
}

.theme-auth .auth-hero__tagline {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  max-width: 28rem;
}

.theme-auth .auth-hero__title {
  font-size: 1.75rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.5rem;
}

.theme-auth .auth-hero__accent {
  color: var(--color-accent);
}

/* Cadastro / recuperar dentro do auth */
.theme-auth .container-fluid .card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.theme-auth .container-fluid .card-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.theme-auth .container-fluid {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
  max-width: 960px;
  margin: 0 auto;
}

.theme-auth .text-muted {
  color: var(--color-text-muted) !important;
}

/* Mobile: formulário em cima, faixa hero abaixo */
@media (max-width: 991.98px) {
  .theme-auth .auth-page__row {
    min-height: auto;
  }

  .theme-auth .auth-page__form-col {
    border-right: none;
    min-height: auto;
  }

  .theme-auth .auth-page__hero {
    min-height: 200px;
    background-position: center center;
  }

  .theme-auth .auth-page__hero-inner {
    position: relative;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(0deg, rgba(10, 10, 11, 0.88) 0%, transparent 100%);
  }

  .theme-auth .auth-hero__title {
    font-size: 1.2rem;
  }
}

/* ---------- Navegação app (sidebar fixa desktop + bottom glass mobile) ---------- */

body.theme-dark #wrapper {
  position: relative;
}

body.theme-dark .invest-nav-root {
  flex: 0 0 auto;
}

/* Mobile: só sidebar oculta — não reserva coluna à esquerda */
@media (max-width: 991.98px) {
  body.theme-dark .invest-nav-root {
    flex: 0 0 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    overflow: visible !important;
  }
}

/* Área principal: evita sobreposição com sidebar (desktop) e barra inferior (mobile) */
@media (min-width: 992px) {
  body.theme-dark #wrapper > #content-wrapper {
    padding-left: var(--invest-sidebar-width);
    transition: padding-left 0.2s ease;
  }

  /* Respiro visual no desktop após remover o topo */
  body.theme-dark #content {
    padding: 0.4rem 0.6rem 0.5rem;
  }
}

@media (max-width: 991.98px) {
  body.theme-dark #wrapper > #content-wrapper {
    padding-bottom: calc(var(--invest-mobile-nav-h) + env(safe-area-inset-bottom, 0px));
  }

  /* Oculta o título textual "Invest - Datameros" no topo mobile */
  body.theme-dark .invest-mobile-home-head,
  body.theme-dark .invest-mobile-home-head__brand,
  body.theme-dark .invest-mobile-home-head__brand--solo {
    display: none !important;
  }
}

/* Sidebar desktop — roxo sólido, rail ícone médio + rótulo compacto */
@media (min-width: 992px) {
  body.theme-dark .invest-app-sidebar.sidenav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    width: var(--invest-sidebar-width);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    flex-direction: column;
    align-items: stretch;
    background-color: var(--color-accent) !important;
    background-image: none !important;
    border-right: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
    overflow: hidden;
  }

  body.theme-dark .invest-app-sidebar .invest-app-sidebar__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding: 0.75rem 0 0.5rem;
  }

  body.theme-dark .invest-app-sidebar .invest-app-sidebar__brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    width: 100%;
  }

  body.theme-dark .invest-app-sidebar .invest-app-sidebar__logo {
    display: block;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  }

  body.theme-dark .invest-app-sidebar .invest-app-sidebar__nav {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-top: 0.35rem;
    padding-bottom: 1rem;
    width: 100%;
  }

  /* Rail: ícone acima do texto — conceito igual ao menu mobile */
  body.theme-dark .invest-app-sidebar .invest-rail-link {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    width: 100% !important;
    max-width: 100%;
    padding: 0.55rem 0.35rem !important;
    text-align: center;
    border-radius: 0.65rem;
    font-weight: 600;
    transition:
      background 0.2s ease,
      box-shadow 0.2s ease,
      transform 0.2s ease;
  }

  /* Inativos: roxo escuro / apagado (alinhado ao bottom nav) */
  body.theme-dark .invest-app-sidebar .nav-item:not(.active) > .invest-rail-link .invest-rail-link__icon i {
    color: rgba(236, 221, 255, 0.8);
    transition: color 0.2s ease;
  }

  body.theme-dark .invest-app-sidebar .nav-item:not(.active) > .invest-rail-link .invest-rail-link__label {
    display: block;
    font-size: 0.56rem;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: 0.02em;
    max-width: 100%;
    padding: 0 0.15rem;
    word-break: break-word;
    hyphens: auto;
    color: rgba(237, 233, 254, 0.78);
    transition: color 0.2s ease;
  }

  body.theme-dark .invest-app-sidebar .invest-rail-link__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
  }

  body.theme-dark .invest-app-sidebar .invest-rail-link__icon i {
    font-size: 1.2rem;
    margin: 0 !important;
  }

  body.theme-dark .invest-app-sidebar .nav-item:not(.active) > .invest-rail-link:hover {
    background: rgba(255, 255, 255, 0.08) !important;
  }

  body.theme-dark .invest-app-sidebar .nav-item:not(.active) > .invest-rail-link:hover .invest-rail-link__icon i {
    color: rgba(255, 255, 255, 0.96);
  }

  body.theme-dark .invest-app-sidebar .nav-item:not(.active) > .invest-rail-link:hover .invest-rail-link__label {
    color: rgba(255, 255, 255, 0.95);
  }

  /* Ativo: gradiente + brilho + texto branco (como item ativo mobile) */
  body.theme-dark .invest-app-sidebar .nav-item.active > .invest-rail-link {
    background:
      linear-gradient(
        155deg,
        rgba(216, 180, 254, 0.5) 0%,
        rgba(139, 92, 246, 0.68) 38%,
        rgba(109, 40, 217, 0.88) 72%,
        rgba(76, 29, 149, 0.92) 100%
      ) !important;
    box-shadow:
      0 0 22px rgba(139, 92, 246, 0.45),
      0 3px 12px rgba(45, 15, 95, 0.35),
      inset 0 1px 0 rgba(255, 255, 255, 0.26) !important;
    color: #fff !important;
  }

  body.theme-dark .invest-app-sidebar .nav-item.active > .invest-rail-link .invest-rail-link__icon i,
  body.theme-dark .invest-app-sidebar .nav-item.active > .invest-rail-link .invest-rail-link__label {
    color: #fff !important;
  }

  body.theme-dark .invest-app-sidebar .nav-item.active > .invest-rail-link:hover {
    background:
      linear-gradient(
        155deg,
        rgba(216, 180, 254, 0.52) 0%,
        rgba(139, 92, 246, 0.72) 38%,
        rgba(109, 40, 217, 0.9) 72%,
        rgba(76, 29, 149, 0.94) 100%
      ) !important;
    color: #fff !important;
  }

  /* Chevron do collapse — abaixo do rótulo */
  body.theme-dark .invest-app-sidebar .nav-link[data-toggle="collapse"]::after {
    float: none !important;
    margin: 0.1rem auto 0 !important;
    width: auto;
    font-size: 0.55rem;
    opacity: 0.85;
    content: "\f107";
  }

  body.theme-dark .invest-app-sidebar .nav-item:not(.active) > .nav-link[data-toggle="collapse"]::after {
    color: rgba(76, 29, 149, 0.58);
  }

  body.theme-dark .invest-app-sidebar .nav-item.active > .nav-link[data-toggle="collapse"]::after {
    color: rgba(255, 255, 255, 0.92) !important;
    opacity: 1;
  }

  body.theme-dark .invest-app-sidebar .nav-link[data-toggle="collapse"].collapsed::after {
    content: "\f105";
  }

  /* Acordeão — submenu dentro da coluna roxa */
  body.theme-dark .invest-app-sidebar .nav-item .collapse,
  body.theme-dark .invest-app-sidebar .nav-item .collapsing {
    margin: 0 0.35rem !important;
  }

  body.theme-dark .invest-app-sidebar .sidebar-submenu-inner {
    background: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.16);
  }

  body.theme-dark .invest-app-sidebar .sidebar-submenu-inner .collapse-item {
    font-size: 0.72rem;
    padding: 0.45rem 0.5rem !important;
  }

  body.theme-dark .invest-app-sidebar .sidebar-heading {
    color: rgba(255, 255, 255, 0.55) !important;
    font-size: 0.58rem !important;
    letter-spacing: 0.12em;
  }

  body.theme-dark .invest-app-sidebar hr.sidebar-divider {
    border-color: rgba(255, 255, 255, 0.18);
  }

  /* SB Admin fixa larguras grandes na classe .sidebar — força rail estreito */
  body.theme-dark .invest-app-sidebar ul.sidebar,
  body.theme-dark .invest-app-sidebar ul.navbar-nav.sidebar {
    width: 100% !important;
    max-width: 100% !important;
  }

  body.theme-dark .invest-app-sidebar .nav-item .nav-link {
    width: 100% !important;
  }
}

/* Oculta sidebar rail no mobile (usa bottom nav) */
@media (max-width: 991.98px) {
  body.theme-dark .invest-app-sidebar {
    display: none !important;
  }
}

/* Bottom navigation — glass / fallback (< 992px; dock no body no footer) */
@media (max-width: 991.98px) {
  body.theme-dark #invest-mobile-nav-dock.invest-mobile-nav,
  body.theme-dark nav.invest-mobile-nav {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100vw !important;
    margin: 0 !important;
    padding: 0 0.5rem !important;
    box-sizing: border-box !important;
    z-index: 1080 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
    align-items: center !important;
    pointer-events: none;
    transform: none !important;
  }
}

body.theme-dark .invest-mobile-nav__shell {
  pointer-events: auto;
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch;
  justify-content: space-between;
  gap: 0.15rem;
  width: min(calc(100vw - 1.25rem), 520px);
  max-width: 520px;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-bottom: calc(0.45rem + env(safe-area-inset-bottom, 0px));
  padding: 0.45rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(109, 40, 217, 0.35);
  box-shadow:
    0 10px 36px rgba(0, 0, 0, 0.55),
    0 1px 0 rgba(255, 255, 255, 0.06) inset;
  background: linear-gradient(180deg, rgba(32, 28, 42, 0.97) 0%, rgba(18, 18, 24, 0.99) 100%);
}

body.theme-dark .invest-mobile-nav__item {
  position: relative;
  flex: 1 1 0;
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0.2rem 0.1rem;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none !important;
  border-radius: 999px;
  transition: color 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}

body.theme-dark .invest-mobile-nav__item > i {
  font-size: 1.15rem;
  margin-bottom: 0.12rem;
}

/* Inativos: roxo escuro e apagado (marca, baixo contraste) */
body.theme-dark .invest-mobile-nav__item:not(.is-active) > i {
  color: rgba(76, 29, 149, 0.62);
  transition: color 0.2s ease;
}

body.theme-dark .invest-mobile-nav__item:not(.is-active) > span:not(.invest-mobile-nav__blob) {
  color: rgba(109, 40, 217, 0.42);
  transition: color 0.2s ease;
}

/* Vidro escuro + blur */
@supports ((-webkit-backdrop-filter: blur(18px)) or (backdrop-filter: blur(18px))) {
  body.theme-dark .invest-mobile-nav__shell {
    background: linear-gradient(
      180deg,
      rgba(38, 32, 52, 0.78) 0%,
      rgba(18, 18, 24, 0.88) 100%
    );
    -webkit-backdrop-filter: blur(20px) saturate(1.25);
    backdrop-filter: blur(20px) saturate(1.25);
    border-color: rgba(109, 40, 217, 0.38);
    box-shadow:
      0 12px 40px rgba(0, 0, 0, 0.45),
      0 1px 0 rgba(255, 255, 255, 0.06) inset;
  }

  body.theme-dark .invest-mobile-nav__item:not(.is-active) > i {
    color: rgba(76, 29, 149, 0.62) !important;
  }

  body.theme-dark .invest-mobile-nav__item:not(.is-active) > span:not(.invest-mobile-nav__blob) {
    color: rgba(109, 40, 217, 0.42) !important;
  }

  body.theme-dark .invest-mobile-nav__item.is-active > i,
  body.theme-dark .invest-mobile-nav__item.is-active > span:not(.invest-mobile-nav__blob) {
    color: #fff !important;
  }
}

/* Ativo: camadas vibrantes (transparências que somam “cheio de vida”, não cinza) */
body.theme-dark .invest-mobile-nav__blob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3.65rem;
  height: 3.65rem;
  margin: 0;
  border-radius: 0.75rem;
  background:
    linear-gradient(
      155deg,
      rgba(216, 180, 254, 0.55) 0%,
      rgba(139, 92, 246, 0.72) 38%,
      rgba(109, 40, 217, 0.88) 72%,
      rgba(76, 29, 149, 0.92) 100%
    );
  box-shadow:
    0 0 26px rgba(139, 92, 246, 0.55),
    0 4px 14px rgba(76, 29, 149, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.92);
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.34, 1.45, 0.64, 1);
  z-index: 0;
  pointer-events: none;
}

body.theme-dark .invest-mobile-nav__item.is-active .invest-mobile-nav__blob {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

body.theme-dark .invest-mobile-nav__item.is-active {
  color: #fff !important;
}

body.theme-dark .invest-mobile-nav__item.is-active i {
  color: #fff !important;
}

body.theme-dark .invest-mobile-nav__item span:not(.invest-mobile-nav__blob),
body.theme-dark .invest-mobile-nav__item i {
  position: relative;
  z-index: 1;
}

@media (min-width: 992px) {
  body.theme-dark #invest-mobile-nav-dock,
  body.theme-dark nav.invest-mobile-nav {
    display: none !important;
  }
}

/* Hub Perfil — mesmo conceito em lista/cards, tema escuro + roxo (tokens do app) */
body.theme-dark .invest-perfil-hub {
  --invest-perfil-bg: var(--color-bg-deep, #0a0a0b);
  --invest-perfil-card: rgba(26, 22, 38, 0.92);
  --invest-perfil-accent: var(--color-accent, #6d28d9);
  --invest-perfil-text: rgba(248, 250, 252, 0.96);
  --invest-perfil-muted: rgba(196, 181, 253, 0.72);
  --invest-perfil-border: rgba(109, 40, 217, 0.38);
  --invest-perfil-shadow: 0 10px 32px rgba(0, 0, 0, 0.55);
  background: var(--invest-perfil-bg);
  color: var(--invest-perfil-text);
  margin-left: 0;
  margin-right: 0;
  margin-top: -0.35rem;
  padding: 1rem 1rem calc(5.5rem + env(safe-area-inset-bottom, 0px));
  min-height: calc(100vh - 120px);
  box-sizing: border-box;
}

@media (min-width: 992px) {
  body.theme-dark .invest-perfil-hub {
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    padding-bottom: 2rem;
    min-height: auto;
    border-radius: 0 0 12px 12px;
  }
}

body.theme-dark .invest-perfil-hub__sheet {
  max-width: 1120px;
  margin: 0 auto;
}

body.theme-dark .invest-perfil-hub__intro {
  background: var(--invest-perfil-card);
  border-radius: 14px;
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--invest-perfil-border);
  box-shadow: var(--invest-perfil-shadow);
  margin-bottom: 1.25rem;
}

body.theme-dark .invest-perfil-hub__intro-line {
  font-size: 0.9rem;
  color: var(--invest-perfil-muted);
}

body.theme-dark .invest-perfil-hub__title {
  font-weight: 700;
  color: var(--invest-perfil-text);
}

body.theme-dark .invest-perfil-hub__subtitle {
  color: var(--invest-perfil-muted);
  margin-top: 0.35rem;
}

body.theme-dark .invest-perfil-hub__heading {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--invest-perfil-muted);
  margin: 0 0 0.5rem 0.15rem;
}

body.theme-dark .invest-perfil-hub__block {
  margin-bottom: 1.15rem;
}

body.theme-dark .invest-perfil-hub__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

body.theme-dark .invest-perfil-hub__block--logout {
  margin-bottom: 0;
}

body.theme-dark .invest-perfil-hub__card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--invest-perfil-card);
  border-radius: 14px;
  padding: 0.95rem 1rem;
  margin-bottom: 0.55rem;
  text-decoration: none !important;
  border: 1px solid var(--invest-perfil-border);
  box-shadow: var(--invest-perfil-shadow);
  color: var(--invest-perfil-accent) !important;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

body.theme-dark .invest-perfil-hub__card-body {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  flex-direction: column;
  gap: 0.18rem;
}

body.theme-dark .invest-perfil-hub__card:hover {
  transform: translateY(-1px);
  border-color: rgba(167, 139, 250, 0.55);
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(139, 92, 246, 0.22);
  color: #c4b5fd !important;
}

body.theme-dark .invest-perfil-hub__card:active {
  transform: translateY(0);
}

body.theme-dark .invest-perfil-hub__card--logout {
  color: rgba(252, 211, 211, 0.98) !important;
  border-color: rgba(239, 68, 68, 0.42);
}

body.theme-dark .invest-perfil-hub__card--logout:hover {
  color: #fecaca !important;
  border-color: rgba(248, 113, 113, 0.55);
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.55),
    0 0 24px rgba(239, 68, 68, 0.18);
}

body.theme-dark .invest-perfil-hub__card--logout .invest-perfil-hub__card-icon {
  color: rgba(248, 113, 113, 0.95);
}

body.theme-dark .invest-perfil-hub__card-icon {
  flex: 0 0 auto;
  width: 2rem;
  text-align: center;
  font-size: 1.2rem;
  color: var(--invest-perfil-accent);
}

body.theme-dark .invest-perfil-hub__card-icon i {
  font-weight: 400;
}

body.theme-dark .invest-perfil-hub__card-label {
  display: block;
  color: var(--invest-perfil-text);
  font-weight: 700;
}

body.theme-dark .invest-perfil-hub__card-desc {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--invest-perfil-muted);
}

body.theme-dark .invest-perfil-hub__card-go {
  flex: 0 0 auto;
  color: var(--invest-perfil-muted);
  font-size: 0.75rem;
  opacity: 0.85;
}

@media (min-width: 992px) {
  body.theme-dark .invest-perfil-hub {
    padding: 1.5rem 1.5rem 2rem;
  }

  body.theme-dark .invest-perfil-hub__intro {
    margin-bottom: 1.35rem;
  }

  body.theme-dark .invest-perfil-hub__heading {
    margin-bottom: 0.65rem;
  }

  body.theme-dark .invest-perfil-hub__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  body.theme-dark .invest-perfil-hub__block:first-of-type .invest-perfil-hub__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.theme-dark .invest-perfil-hub__card {
    min-height: 7rem;
    padding: 1rem 1.05rem;
  }
}

/* Home (dashboard) — topo mobile: nome + marca; cards mais compactos */
@media (max-width: 991.98px) {
  body.theme-dark .invest-mobile-home-head__brand--solo {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.25;
    color: var(--color-accent, #6d28d9);
    text-shadow: 0 0 24px rgba(109, 40, 217, 0.35);
  }

  body.theme-dark #div_dashboard .card.shadow .card-header {
    padding: 0.35rem 0.45rem;
  }

  body.theme-dark #div_dashboard .card.shadow .card-header h6 {
    font-size: 0.62rem;
    line-height: 1.15;
    margin-bottom: 0;
  }

  body.theme-dark #div_dashboard .card.shadow .card-body {
    padding: 0.45rem 0.5rem;
  }

  body.theme-dark #div_dashboard .card.shadow .h5 {
    font-size: 0.92rem !important;
    line-height: 1.25;
  }

  body.theme-dark #div_dashboard .dashboard-section-title {
    font-size: 1.05rem !important;
  }

  body.theme-dark #div_dashboard .dashboard-visao-carteira .card-body {
    padding: 0.65rem 0.75rem !important;
  }

  body.theme-dark #div_dashboard .dashboard-visao-carteira .small {
    font-size: 0.72rem !important;
    line-height: 1.35;
  }

  body.theme-dark #div_dashboard .dashboard-visao-carteira .btn-group-sm .btn {
    padding: 0.25rem 0.45rem;
    font-size: 0.72rem;
  }
}

/* Editar meus dados — inputs/selects/botão no padrão dos cards Perfil (dark + roxo, pill) */
body.theme-dark .invest-edit-dados {
  color-scheme: dark;
  --ied-border: rgba(109, 40, 217, 0.38);
  --ied-surface: rgba(26, 22, 38, 0.92);
  --ied-text: rgba(248, 250, 252, 0.96);
  --ied-muted: rgba(196, 181, 253, 0.72);
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
}

body.theme-dark .invest-edit-dados__panel {
  background: var(--ied-surface);
  border: 1px solid var(--ied-border) !important;
  border-radius: 16px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
}

body.theme-dark .invest-edit-dados__panel-head {
  background: transparent;
  border-bottom: 1px solid var(--ied-border);
}

body.theme-dark .invest-edit-dados__panel-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ied-muted);
}

body.theme-dark .invest-edit-dados .card-body {
  padding: 1.1rem 1rem 1.25rem;
}

body.theme-dark .invest-edit-dados__section {
  border-bottom-color: rgba(109, 40, 217, 0.22);
}

body.theme-dark .invest-edit-dados__section-title {
  color: var(--ied-muted, rgba(196, 181, 253, 0.85));
}

body.theme-dark .invest-edit-dados__section--immutable {
  background: rgba(109, 40, 217, 0.12);
  border-color: rgba(167, 139, 250, 0.28);
}

body.theme-dark .invest-edit-dados__immutable-label {
  color: rgba(196, 181, 253, 0.65);
}

body.theme-dark .invest-edit-dados__immutable-value {
  color: var(--ied-text, rgba(248, 250, 252, 0.96));
}

body.theme-dark .invest-edit-dados label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ied-muted);
  margin-bottom: 0.4rem;
}

body.theme-dark .invest-edit-dados .form-control {
  height: auto;
  min-height: 2.55rem;
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  color: var(--ied-text);
  background-color: rgba(15, 12, 28, 0.65);
  border: 1px solid var(--ied-border);
  border-radius: 999px;
  box-shadow: none;
}

body.theme-dark .invest-edit-dados .form-control:focus {
  color: var(--ied-text);
  background-color: rgba(15, 12, 28, 0.85);
  border-color: rgba(167, 139, 250, 0.55);
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.22);
}

body.theme-dark .invest-edit-dados .form-control::placeholder {
  color: rgba(196, 181, 253, 0.45);
}

body.theme-dark .invest-edit-dados .form-control[readonly] {
  opacity: 0.72;
  cursor: not-allowed;
}

body.theme-dark .invest-edit-dados select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23c4b5fd' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.25rem;
}

body.theme-dark .invest-edit-dados__actions {
  display: flex;
  justify-content: center;
  margin-top: 1.25rem;
  padding-top: 0.25rem;
}

body.theme-dark .invest-edit-dados__btn-save {
  min-width: 11rem;
  padding: 0.65rem 1.75rem;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid rgba(167, 139, 250, 0.45);
  background: linear-gradient(135deg, #7c3aed 0%, var(--color-accent, #6d28d9) 45%, #5b21b6 100%);
  box-shadow:
    0 6px 22px rgba(109, 40, 217, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

body.theme-dark .invest-edit-dados__btn-save:hover {
  filter: brightness(1.06);
  border-color: rgba(196, 181, 253, 0.55);
  box-shadow:
    0 8px 28px rgba(109, 40, 217, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

@media (max-width: 575.98px) {
  body.theme-dark .invest-edit-dados .form-control {
    font-size: 16px;
  }
}

/* Meus dados — formulário tipo app (fundo escuro + bordas roxas) */
body.theme-dark .invest-edit-dados.invest-mprofile {
  color-scheme: dark;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
}

body.theme-dark .invest-mprofile__sheet {
  background: var(--color-bg-deep, #0a0a0b);
  border-radius: 0;
}

body.theme-dark .invest-mprofile__topbar {
  background: linear-gradient(180deg, rgba(10, 10, 11, 0.98) 0%, rgba(10, 10, 11, 0.88) 100%);
  backdrop-filter: blur(8px);
}

body.theme-dark .invest-mprofile__back {
  color: rgba(248, 250, 252, 0.92);
  background: rgba(26, 22, 38, 0.85);
  border: 1px solid rgba(109, 40, 217, 0.35);
}

body.theme-dark .invest-mprofile__back:hover {
  color: #fff;
  border-color: rgba(167, 139, 250, 0.55);
  background: rgba(109, 40, 217, 0.25);
}

body.theme-dark .invest-mprofile__title {
  color: rgba(248, 250, 252, 0.96);
}

body.theme-dark .invest-mprofile__intro,
body.theme-dark .invest-mprofile__section-sub,
body.theme-dark .invest-mprofile__hint {
  color: rgba(196, 181, 253, 0.55);
}

body.theme-dark .invest-mprofile__section-heading {
  color: rgba(248, 250, 252, 0.95);
}

body.theme-dark .invest-outlined-field__box {
  background: rgba(15, 12, 28, 0.55);
  border-color: rgba(109, 40, 217, 0.35);
}

body.theme-dark .invest-outlined-field__box:focus-within {
  border-color: rgba(167, 139, 250, 0.65);
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.22);
}

body.theme-dark .invest-outlined-field__legend {
  color: rgba(196, 181, 253, 0.75);
  background: var(--color-bg-deep, #0a0a0b);
}

body.theme-dark .invest-outlined-field--readonly .invest-outlined-field__box {
  background: rgba(109, 40, 217, 0.1);
  border-color: rgba(109, 40, 217, 0.28);
}

body.theme-dark .invest-outlined-field--readonly .invest-outlined-field__legend {
  background: var(--color-bg-deep, #0a0a0b);
}

body.theme-dark .invest-outlined-field__input {
  color: rgba(248, 250, 252, 0.96);
}

body.theme-dark .invest-outlined-field__input--select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23c4b5fd' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
}

/* iOS/Android/WebView podem abrir a lista nativa com fundo claro.
   Força contraste das opções para evitar texto "branco no branco". */
body.theme-dark .invest-edit-dados .invest-outlined-field__input--select option,
body.theme-dark .invest-edit-dados .invest-outlined-field__input--select optgroup {
  color: #111827;
  background-color: #ffffff;
}

body.theme-dark .invest-outlined-field__static {
  color: rgba(248, 250, 252, 0.96);
}

body.theme-dark .invest-mprofile__submit {
  color: #fff;
  background: linear-gradient(135deg, #8b5cf6 0%, var(--color-accent, #6d28d9) 42%, #4c1d95 100%);
  box-shadow:
    0 8px 28px rgba(109, 40, 217, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

body.theme-dark .invest-mprofile__submit:hover {
  filter: brightness(1.08);
}

body.theme-dark .invest-outlined-field__box:has(.invest-outlined-field__input.is-invalid) {
  border-color: rgba(248, 113, 113, 0.65);
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.15);
}

@media (max-width: 575.98px) {
  body.theme-dark .invest-outlined-field__input,
  body.theme-dark .invest-outlined-field__input--select {
    font-size: 16px;
  }
}

/* Carteira — KPIs, lista/cards/tabela (alinhado ao painel invest-edit-dados) */
body.theme-dark .invest-carteira.invest-edit-dados {
  color-scheme: dark;
  /* Base escura neutra; roxo fica para destaques pontuais */
  --ic-border: rgba(255, 255, 255, 0.12);
  --ic-border-soft: rgba(255, 255, 255, 0.08);
  --ic-surface: rgba(20, 20, 22, 0.94);
  --ic-surface-2: rgba(16, 16, 19, 0.92);
  --ic-text: rgba(248, 250, 252, 0.96);
  --ic-muted: rgba(161, 161, 170, 0.9);
}

body.theme-dark .invest-carteira__panel {
  border-color: var(--ic-border) !important;
  background: var(--ic-surface);
}

body.theme-dark .invest-carteira__panel--plain {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

body.theme-dark .invest-carteira__panel--plain .invest-carteira__panel-head {
  background: transparent !important;
  border-bottom-color: transparent !important;
}

body.theme-dark .invest-carteira__panel-head {
  border-bottom: 1px solid var(--ic-border-soft);
  background: rgba(255, 255, 255, 0.01);
}

body.theme-dark .invest-carteira__summary {
  margin-bottom: 1.25rem;
}

body.theme-dark .invest-carteira__summary-eyebrow {
  display: none;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ic-muted, rgba(196, 181, 253, 0.72));
  margin-bottom: 0.65rem;
}

body.theme-dark .invest-carteira__kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

body.theme-dark .invest-carteira__kpi-card {
  position: relative;
  display: grid;
  grid-template-columns: 2.35rem 1fr;
  grid-template-rows: auto 1fr;
  column-gap: 0.75rem;
  row-gap: 0.2rem;
  align-items: start;
  background: var(--ic-surface-2);
  border: 1px solid var(--ic-border);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

body.theme-dark .invest-carteira__kpi-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.85), rgba(124, 58, 237, 0.25));
  opacity: 0.7;
}

body.theme-dark .invest-carteira__kpi-icon {
  grid-row: 1 / span 2;
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  margin-top: 0.15rem;
  border-radius: 12px;
  background: rgba(124, 58, 237, 0.2);
  color: rgba(221, 214, 254, 0.9);
  font-size: 0.95rem;
}

body.theme-dark .invest-carteira__kpi-label {
  grid-column: 2;
  grid-row: 1;
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ic-muted, rgba(196, 181, 253, 0.72));
  margin-bottom: 0;
}

body.theme-dark .invest-carteira__kpi-value {
  grid-column: 2;
  grid-row: 2;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ic-text, rgba(248, 250, 252, 0.96));
  line-height: 1.2;
}

body.theme-dark .invest-carteira__kpi-sub {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ic-muted);
  font-size: 0.72rem;
  line-height: 1.35;
  white-space: normal;
  word-break: normal;
}

body.theme-dark .invest-carteira__kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
}

body.theme-dark .invest-carteira__kpi-value-row {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}

body.theme-dark .invest-carteira__kpi-trend--up {
  color: #22c55e;
}

body.theme-dark .invest-carteira__kpi-trend--down {
  color: #ef4444;
}

body.theme-dark .invest-copy-icon-btn {
  color: #a78bfa !important;
  text-decoration: none !important;
}

body.theme-dark .invest-copy-icon-btn:hover,
body.theme-dark .invest-copy-icon-btn:focus {
  color: #c4b5fd !important;
}

body.theme-dark .invest-copy-icon-btn--ok {
  color: #22c55e !important;
}

body.theme-dark .invest-carteira__ativos-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--ic-border-soft);
}

body.theme-dark .invest-carteira__ativos-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ic-text);
}

body.theme-dark .invest-carteira__ativos-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ic-muted);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--ic-border);
  background: rgba(255, 255, 255, 0.03);
}

/* Cabeçalho do painel: desktop em linha; mobile empilhado */
body.theme-dark .invest-carteira__panel-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

body.theme-dark .invest-carteira__header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

body.theme-dark .invest-carteira__header-btn {
  margin: 0;
}

/* Toolbar: filtro + segmento em linha no desktop */
body.theme-dark .invest-carteira__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

body.theme-dark .invest-carteira__toolbar-filtro {
  flex: 0 1 auto;
}

body.theme-dark .invest-carteira__toolbar .form-control,
body.theme-dark .invest-carteira__filtro {
  min-width: 8.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--ic-border);
  color: var(--ic-text);
}

/* Segmento Lista / Cards / Tabela: uma “cápsula” com cantos arredondados só nas pontas */
body.theme-dark .invest-carteira__view-toggle.btn-group {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: stretch;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--ic-border);
  background: rgba(255, 255, 255, 0.02);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.theme-dark .invest-carteira__view-toggle.btn-group > .btn {
  border-radius: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  color: rgba(248, 250, 252, 0.92);
  background: transparent;
  white-space: nowrap;
}

body.theme-dark .invest-carteira__view-toggle.btn-group > .btn + .btn {
  border-left: 1px solid var(--ic-border-soft) !important;
}

body.theme-dark .invest-carteira__view-toggle.btn-group > .btn:focus,
body.theme-dark .invest-carteira__view-toggle.btn-group > .btn:active {
  box-shadow: none !important;
}

body.theme-dark .invest-carteira__view-toggle .btn.is-active {
  background: linear-gradient(135deg, #7c3aed 0%, var(--color-accent, #6d28d9) 55%, #5b21b6 100%) !important;
  color: #fff !important;
}

body.theme-dark .invest-carteira__view-toggle .btn.is-active + .btn {
  border-left-color: rgba(91, 33, 182, 0.45) !important;
}

body.theme-dark .invest-carteira__view-toggle .btn-outline-light:not(.is-active):hover {
  background: rgba(109, 40, 217, 0.18);
  color: #fff;
}

body.theme-dark .invest-carteira__view-btn .invest-carteira__view-btn-text {
  margin-left: 0.25rem;
}

body.theme-dark .invest-carteira__view {
  display: none !important;
}

body.theme-dark .invest-carteira[data-view='list'] .invest-carteira__view--list,
body.theme-dark .invest-carteira[data-view='grid'] .invest-carteira__view--grid,
body.theme-dark .invest-carteira[data-view='table'] .invest-carteira__view--table {
  display: block !important;
}

body.theme-dark .invest-carteira__list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Lista de ativos — layout desktop (≥980px): linha compacta */
body.theme-dark .invest-carteira__list-item {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--ic-surface-2);
  border: 1px solid var(--ic-border);
  border-radius: 14px;
}

body.theme-dark .invest-carteira__list-primary {
  flex: 1 1 auto;
  min-width: 0;
}

body.theme-dark .invest-carteira__list-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

body.theme-dark .invest-carteira__list-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  background: rgba(124, 58, 237, 0.16);
  color: rgba(221, 214, 254, 0.9);
  flex-shrink: 0;
}

body.theme-dark .invest-carteira__list-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.2rem;
}

body.theme-dark .invest-carteira__list-ticker-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

body.theme-dark .invest-carteira__ticker {
  font-size: 1rem;
  font-weight: 800;
  color: var(--ic-text);
  letter-spacing: 0.02em;
}

body.theme-dark .invest-carteira__tipo-pill {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(124, 58, 237, 0.45);
  background: rgba(124, 58, 237, 0.18);
  color: rgba(221, 214, 254, 0.92);
}

body.theme-dark .invest-carteira__nome {
  font-size: 0.78rem;
  color: var(--ic-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 14rem;
}

body.theme-dark .invest-carteira__list-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
}

body.theme-dark .invest-carteira__aside-stack {
  text-align: right;
}

body.theme-dark .invest-carteira__aside-pos-row {
  display: block;
}

body.theme-dark .invest-carteira__aside-label {
  display: none;
}

body.theme-dark .invest-carteira__aside-value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--ic-text);
}

body.theme-dark .invest-carteira__aside-compact {
  display: block;
  font-size: 0.72rem;
  color: var(--ic-muted);
  margin-top: 0.12rem;
}

body.theme-dark .invest-carteira__aside-chips {
  display: none;
  flex-wrap: wrap;
  gap: 0.45rem;
}

body.theme-dark .invest-carteira__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.55rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--ic-border-soft);
  font-size: 0.72rem;
}

body.theme-dark .invest-carteira__chip-k {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.58rem;
  color: var(--ic-muted);
}

body.theme-dark .invest-carteira__chip-v {
  font-weight: 700;
  color: var(--ic-text);
}

body.theme-dark .invest-carteira__btn-compra {
  margin-top: 0.2rem;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  line-height: 1.2;
  font-weight: 700;
}

body.theme-dark .invest-carteira__btn-compra .invest-carteira__btn-compra-txt {
  display: none;
}

body.theme-dark .invest-carteira__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}

body.theme-dark .invest-carteira__grid-card {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  background: var(--ic-surface-2);
  border: 1px solid var(--ic-border);
  border-radius: 16px;
}

body.theme-dark .invest-carteira__grid-head {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

body.theme-dark .invest-carteira__grid-head > div {
  flex: 1 1 auto;
  min-width: 0;
}

body.theme-dark .invest-carteira__grid-head .invest-carteira__ticker,
body.theme-dark .invest-carteira__grid-head .invest-carteira__nome {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.theme-dark .invest-carteira__grid-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  background: rgba(109, 40, 217, 0.2);
  color: rgba(196, 181, 253, 0.95);
  flex-shrink: 0;
}

body.theme-dark .invest-carteira__grid-dl {
  margin: 0 0 0.85rem;
  font-size: 0.8rem;
}

body.theme-dark .invest-carteira__grid-dl > div {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--ic-border-soft);
}

body.theme-dark .invest-carteira__grid-dl dt {
  margin: 0;
  font-weight: 600;
  color: var(--ic-muted);
}

body.theme-dark .invest-carteira__grid-dl dd {
  margin: 0;
  color: var(--ic-text);
  text-align: right;
}

body.theme-dark .invest-carteira__grid-pos {
  font-weight: 800;
}

/* Extrato (visualizador) em formato de lista linear */
body.theme-dark .invest-extrato-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

body.theme-dark .invest-extrato-list__head {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(196, 181, 253, 0.75);
}

body.theme-dark .invest-extrato-item {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(109, 40, 217, 0.28);
  background: rgba(15, 12, 28, 0.55);
}

body.theme-dark .invest-extrato-item__sigla {
  min-width: 0;
}

body.theme-dark .invest-extrato-item__sigla strong {
  display: block;
  color: rgba(248, 250, 252, 0.96);
  font-size: 0.95rem;
  line-height: 1.2;
}

body.theme-dark .invest-extrato-item__sigla span {
  display: block;
  margin-top: 0.15rem;
  color: rgba(196, 181, 253, 0.75);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.theme-dark .invest-extrato-item__tipo,
body.theme-dark .invest-extrato-item__data {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  min-width: 0;
}

body.theme-dark .invest-extrato-field,
body.theme-dark .invest-extrato-item__tipo,
body.theme-dark .invest-extrato-item__data {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.12rem;
}

body.theme-dark .invest-extrato-field__label {
  color: rgba(196, 181, 253, 0.72);
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}

body.theme-dark .invest-extrato-field__value {
  color: rgba(248, 250, 252, 0.96);
  font-size: 0.84rem;
  line-height: 1.2;
}

@media (max-width: 979.98px) {
  body.theme-dark .invest-extrato-item {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }
}

body.theme-dark .invest-carteira__grid-actions {
  margin-top: auto;
}

body.theme-dark .invest-carteira__table-wrap {
  border-radius: 12px;
  overflow: hidden;
}

body.theme-dark .invest-carteira__empty {
  padding: 0.5rem 0;
}

/* Carteira — layout <980px (tablet estreito + mobile): “app sheet” */
@media (max-width: 979.98px) {
  body.theme-dark .invest-carteira.container-fluid {
    padding-left: max(0.65rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.65rem, env(safe-area-inset-right, 0px));
    padding-bottom: 0.5rem;
  }

  body.theme-dark .invest-carteira__panel {
    border-radius: 20px !important;
    overflow: hidden;
    border: 1px solid rgba(109, 40, 217, 0.35) !important;
    box-shadow:
      0 10px 40px rgba(0, 0, 0, 0.5),
      0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  }

  body.theme-dark .invest-carteira.invest-edit-dados .invest-carteira__panel .card-body {
    padding: 1rem 0.85rem 1.15rem;
    background: linear-gradient(180deg, rgba(22, 18, 34, 0.35) 0%, rgba(12, 10, 20, 0.2) 100%);
  }

  body.theme-dark .invest-carteira__panel--plain {
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }

  body.theme-dark .invest-carteira.invest-edit-dados .invest-carteira__panel--plain .card-body {
    background: transparent !important;
  }

  body.theme-dark .invest-carteira__panel-head-row {
    flex-direction: column;
    align-items: stretch;
    padding-top: 0.85rem !important;
    padding-bottom: 0.85rem !important;
  }

  body.theme-dark .invest-carteira__panel-title {
    font-size: 0.78rem !important;
    text-align: center;
  }

  body.theme-dark .invest-carteira__header-actions {
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    gap: 0.5rem;
  }

  body.theme-dark .invest-carteira__header-actions .invest-carteira__header-btn {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 0;
    justify-content: center;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
    font-weight: 700;
  }

  body.theme-dark .invest-carteira__header-actions .btn-outline-light {
    color: rgba(248, 250, 252, 0.92) !important;
    border-color: rgba(167, 139, 250, 0.45) !important;
    background: rgba(15, 12, 28, 0.55) !important;
  }

  body.theme-dark .invest-carteira__summary-eyebrow {
    display: block;
  }

  body.theme-dark .invest-carteira__summary {
    margin-bottom: 1rem;
  }

  body.theme-dark .invest-carteira__kpis {
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
  }

  body.theme-dark .invest-carteira__kpi-card {
    padding: 0.85rem 0.75rem 0.95rem;
    padding-top: calc(0.85rem + 3px);
    border-radius: 16px;
    min-height: 5.5rem;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
  }

  body.theme-dark .invest-carteira__kpi-value {
    font-size: 1.15rem;
  }

  body.theme-dark .invest-carteira__ativos-head {
    margin-top: 0.15rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid rgba(109, 40, 217, 0.28);
  }

  body.theme-dark .invest-carteira__ativos-title {
    font-size: 0.8rem;
  }

  body.theme-dark .invest-carteira__toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.85rem !important;
    border-radius: 14px;
    background: rgba(15, 12, 28, 0.45);
    border: 1px solid rgba(109, 40, 217, 0.22);
  }

  body.theme-dark .invest-carteira__toolbar-filtro,
  body.theme-dark .invest-carteira__toolbar .invest-carteira__filtro {
    width: 100%;
    min-width: 0;
  }

  body.theme-dark .invest-carteira__filtro {
    min-height: 2.65rem;
    font-size: 16px;
  }

  body.theme-dark .invest-carteira__view-toggle.btn-group {
    width: 100%;
    justify-content: stretch;
  }

  body.theme-dark .invest-carteira__view-toggle.btn-group > .btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.55rem 0.35rem;
    font-size: 0.78rem;
  }

  /* Cartão de ativo — coluna, hierarquia clara */
  body.theme-dark .invest-carteira__list {
    gap: 0.85rem;
  }

  body.theme-dark .invest-carteira__list-item {
    width: 100%;
    max-width: 100%;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    gap: 0;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(165deg, rgba(32, 26, 52, 0.95) 0%, rgba(16, 12, 26, 0.98) 55%, rgba(14, 11, 22, 1) 100%);
    border: 1px solid rgba(167, 139, 250, 0.22);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.42);
  }

  body.theme-dark .invest-carteira__list-primary {
    min-width: 0;
    padding: 0.85rem 0.95rem 0.65rem;
  }

  body.theme-dark .invest-carteira__list-main {
    align-items: flex-start;
  }

  body.theme-dark .invest-carteira__ticker {
    font-size: 1.12rem;
  }

  body.theme-dark .invest-carteira__nome {
    max-width: none;
    white-space: normal;
    text-transform: none;
    letter-spacing: 0.02em;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: rgba(196, 181, 253, 0.82);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  body.theme-dark .invest-carteira__list-aside {
    width: 100%;
    min-width: 0;
    align-items: stretch;
    padding: 0.75rem 0.95rem 0.95rem;
    border-top: 1px solid rgba(109, 40, 217, 0.2);
    background: rgba(0, 0, 0, 0.18);
    gap: 0.65rem;
  }

  body.theme-dark .invest-carteira__aside-stack {
    text-align: left;
  }

  body.theme-dark .invest-carteira__aside-pos-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
  }

  body.theme-dark .invest-carteira__aside-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--ic-muted);
  }

  body.theme-dark .invest-carteira__aside-value {
    font-size: 1.2rem;
    font-weight: 800;
  }

  body.theme-dark .invest-carteira__aside-compact {
    display: none !important;
  }

  body.theme-dark .invest-carteira__aside-chips {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  body.theme-dark .invest-carteira__chip {
    width: 100%;
    max-width: 100%;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    gap: 0.15rem;
    padding: 0.45rem 0.35rem;
    overflow: hidden;
  }

  body.theme-dark .invest-carteira__chip-k,
  body.theme-dark .invest-carteira__chip-v {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.theme-dark .invest-carteira__btn-compra {
    width: 100%;
    margin-top: 0;
    padding: 0.65rem 1rem;
    border-radius: 12px !important;
    font-size: 0.9rem;
    font-weight: 800;
    box-shadow: 0 4px 16px rgba(109, 40, 217, 0.35);
  }

  body.theme-dark .invest-carteira__btn-compra .invest-carteira__btn-compra-txt {
    display: inline;
  }

  body.theme-dark .invest-carteira__grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  body.theme-dark .invest-carteira__grid-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0.95rem 1rem;
    border-radius: 18px;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
    border-color: rgba(167, 139, 250, 0.25);
  }

  body.theme-dark .invest-carteira__table-wrap {
    margin: 0 -0.35rem;
    border-radius: 14px;
    -webkit-overflow-scrolling: touch;
    border: 1px solid rgba(109, 40, 217, 0.2);
  }

  body.theme-dark .invest-carteira__table-wrap .table {
    font-size: 0.78rem;
    margin-bottom: 0;
  }

  body.theme-dark .invest-carteira__table-wrap .table th,
  body.theme-dark .invest-carteira__table-wrap .table td {
    padding: 0.5rem 0.45rem;
    vertical-align: middle;
  }
}

@media (max-width: 420px) {
  body.theme-dark .invest-carteira__kpis {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  body.theme-dark .invest-carteira__view-toggle .invest-carteira__view-btn-text {
    display: none;
  }

  body.theme-dark .invest-carteira__view-toggle.btn-group > .btn {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

@media (max-width: 330px) {
  body.theme-dark .invest-carteira__ticker {
    font-size: 1rem;
  }

  body.theme-dark .invest-carteira__tipo-pill {
    font-size: 0.56rem;
    padding: 0.08rem 0.35rem;
  }

  body.theme-dark .invest-carteira__nome {
    font-size: 0.74rem;
    line-height: 1.35;
  }

  body.theme-dark .invest-carteira__aside-label {
    font-size: 0.58rem;
  }

  body.theme-dark .invest-carteira__aside-value {
    font-size: 1.05rem;
  }

  body.theme-dark .invest-carteira__chip-k {
    font-size: 0.52rem;
  }

  body.theme-dark .invest-carteira__chip-v {
    font-size: 0.68rem;
  }

  body.theme-dark .invest-carteira__btn-compra {
    font-size: 0.82rem;
    padding: 0.58rem 0.85rem;
  }
}
