/* Dark UI dedicado
   Sistema visual desenhado especificamente para o modo escuro.
   Não contém regras do modo claro. */

html[data-theme="dark"]{
  color-scheme:dark;

  /* Tokens compartilhados com o novo Comercial */
  --bg:#17181A;
  --surface:#202124;
  --surface-strong:#292A2E;
  --surface-hover:#26272B;
  --text:#edf4fb;
  --text-muted:#a7b6c8;
  --text-subtle:#74889f;
  --brand:#414349;
  --accent:#3A73ED;
  --divider:rgba(184,207,232,.075);
  --shadow-card:0 14px 34px rgba(0,0,0,.14);
  --shadow-floating:0 22px 54px rgba(0,0,0,.24);

  /* Tokens semânticos V44 (mesmos nomes do modo claro) */
  --text-1:#edf4fb;
  --text-2:#c3d0dd;
  --text-3:#93a5b8;
  --surface-2:#26282B;
  --line-soft:rgba(184,207,232,.06);
  --row-hover:#2A2C30;

  /* Compatibilidade com os nomes usados pelos módulos atuais */
  --ink:var(--text);
  --muted:var(--text-muted);
  --line:var(--divider);
  --line-strong:rgba(184,207,232,.14);
  --page:var(--bg);
  --soft:var(--surface-strong);
  --green:#47bd89;
  --red:#ff7474;
  --amber:#e6a84a;
  --shadow-sm:0 8px 24px rgba(0,0,0,.16);
  --shadow:var(--shadow-card);
  --shadow-lg:0 26px 70px rgba(0,0,0,.36);
  --focus:0 0 0 3px rgba(58,115,237,.18);

  --theme-surface:var(--surface);
  --theme-surface-2:var(--surface-hover);
  --theme-surface-3:var(--surface-strong);
  --theme-text:var(--text);
  --theme-text-strong:#f8fbff;
  --theme-muted:var(--text-muted);
  --theme-line:var(--divider);
  --theme-line-strong:rgba(184,207,232,.14);
  --theme-blue:#7ab8f0;
  --theme-orange:var(--accent);
  --theme-heading:#f8fbff;
  --theme-subheading:#dce8f5;
  --theme-name:#edf4fb;
  --theme-label:#91a5ba;
  --theme-result:#ffffff;
  --theme-result-accent:#88AAF4;
  --theme-link:#93c5fd;
  --theme-deep:#1A1B1D;
  --theme-raised:#26282B;
  --theme-raised-2:#292A2E;
  --theme-accent-soft:rgba(58,115,237,.10);
  --theme-accent-soft-2:rgba(58,115,237,.16);
  --theme-accent-border:rgba(58,115,237,.38);

  --chart-text:#a7b6c8;
  --chart-grid:rgba(184,207,232,.09);
  --chart-navy:#93c5fd;
  --chart-orange:#3A73ED;
  --chart-blue:#7ab8f0;
  --chart-gray:#74889f;
  --chart-green:#47bd89;
}

html[data-theme="dark"] body{
  background:
    radial-gradient(circle at 84% -8%,rgba(58,115,237,.07),transparent 28rem),
    var(--page);
  color:var(--theme-text);
}
html[data-theme="dark"] ::selection{background:rgba(91,169,228,.28);color:#fff}
html[data-theme="dark"] ::-webkit-scrollbar{width:10px;height:10px}
html[data-theme="dark"] ::-webkit-scrollbar-track{background:#1A1B1D}
html[data-theme="dark"] ::-webkit-scrollbar-thumb{background:#37393E;border:2px solid #1A1B1D;border-radius:999px}
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover{background:#46484F}

/* Estrutura principal */
html[data-theme="dark"] .app-view,
html[data-theme="dark"] .app-shell,
html[data-theme="dark"] .content{background:var(--page);color:var(--theme-text)}
html[data-theme="dark"] .page-header,
html[data-theme="dark"] .section-header{border-color:var(--theme-line)}
html[data-theme="dark"] .page-header h2,
html[data-theme="dark"] .section-header h3,
html[data-theme="dark"] .empty-state>strong,
html[data-theme="dark"] .system-state,
html[data-theme="dark"] .profile-drawer-head strong,
html[data-theme="dark"] .profile-identity strong{color:var(--theme-text-strong)}
html[data-theme="dark"] .page-header p,
html[data-theme="dark"] .section-header p,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .empty-state p,
html[data-theme="dark"] #appView .content p,
html[data-theme="dark"] #appView .content small{color:var(--theme-muted)}
html[data-theme="dark"] .system-state-icon,
html[data-theme="dark"] .empty-state-icon{background:#292A2E;color:var(--theme-blue)}
html[data-theme="dark"] .system-state.is-error .system-state-icon{background:rgba(217,80,80,.13);color:#ff7f7f}

/* Controles globais e perfil */
html[data-theme="dark"] .profile-trigger,html[data-theme="dark"] .profile-drawer,html[data-theme="dark"] .profile-drawer-head button,html[data-theme="dark"] .secondary-action,html[data-theme="dark"] .mini-modal,html[data-theme="dark"] .modal-close,html[data-theme="dark"] .toast,html[data-theme="dark"] .optimistic-status,html[data-theme="dark"] .advanced-filter-popover,html[data-theme="dark"] .advanced-filter-close{
  background:var(--theme-surface)!important;
  color:var(--theme-text)!important;
  border-color:var(--theme-line)!important;
}
html[data-theme="dark"] .profile-trigger{box-shadow:0 8px 24px rgba(0,0,0,.24)}
html[data-theme="dark"] .profile-drawer{box-shadow:0 28px 80px rgba(0,0,0,.48)}
html[data-theme="dark"] .profile-photo-preview{
  border-color:#303136;
  background:linear-gradient(145deg,#33353A,#232528);
  color:var(--theme-text-strong);
  box-shadow:0 0 0 1px #3E4046,0 10px 28px rgba(0,0,0,.24);
}
html[data-theme="dark"] .profile-context>span{background:#292A2E;color:#9fb0c0}
html[data-theme="dark"] .profile-photo-remove,
html[data-theme="dark"] .profile-logout-button{
  background:rgba(217,80,80,.08);
  color:#ff858b;
  border-color:rgba(217,80,80,.28);
}
html[data-theme="dark"] .profile-logout-button:hover{
  background:rgba(217,80,80,.14);
  color:#ffa0a5;
  border-color:rgba(255,116,116,.42);
}

/* Controle de aparência no modo escuro */
html[data-theme="dark"] .theme-icon-light{display:none}
html[data-theme="dark"] .theme-icon-dark{display:block}

/* Inputs e filtros */
html[data-theme="dark"] #appView input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),html[data-theme="dark"] #appView select,html[data-theme="dark"] #appView textarea,html[data-theme="dark"] .form-field input,html[data-theme="dark"] .form-field select,html[data-theme="dark"] .filter-field input,html[data-theme="dark"] .filter-field select,html[data-theme="dark"] .compact-input,html[data-theme="dark"] .advanced-filter-field input,html[data-theme="dark"] .advanced-filter-field select{
  background:#1C1D20!important;
  color:var(--theme-text-strong)!important;
  border-color:var(--theme-line)!important;
}
html[data-theme="dark"] #appView input::placeholder,
html[data-theme="dark"] #appView textarea::placeholder{color:#697b8d}
html[data-theme="dark"] #appView select option,
html[data-theme="dark"] #appView select optgroup{background:#1C1D20;color:var(--theme-text)}
html[data-theme="dark"] .readonly-value{background:#26282B;color:#9fb0c0;border-color:var(--theme-line)}
html[data-theme="dark"] .weekly-seller-overview-metrics{
  background:rgba(23,24,26,.86)!important;
  border-color:var(--theme-line)!important;
}

/* Cards, painéis e superfícies brancas */
html[data-theme="dark"] .chart-panel,html[data-theme="dark"] .saved-item,html[data-theme="dark"] .dashboard-period-panel,html[data-theme="dark"] .sales-table-wrap,html[data-theme="dark"] .audit-icon-options,html[data-theme="dark"] .referral-seller-filter select,html[data-theme="dark"] .referrals-table-scroll,html[data-theme="dark"] .referral-audit-options,html[data-theme="dark"] .team-config-fields select,html[data-theme="dark"] .team-member-search,html[data-theme="dark"] .team-member-option,html[data-theme="dark"] .weekly-assigned-task,html[data-theme="dark"] .weekly-task-row:not(.header),html[data-theme="dark"] .weekly-challenge-row:not(.header),html[data-theme="dark"] .weekly-report-list,html[data-theme="dark"] .weekly-report-card,html[data-theme="dark"] .weekly-manager-context select,html[data-theme="dark"] .weekly-manager-context input,html[data-theme="dark"] .weekly-definition-modal-section,html[data-theme="dark"] .weekly-seller-option{
  background:var(--theme-surface)!important;
  color:var(--theme-text)!important;
  border-color:var(--theme-line)!important;
}
html[data-theme="dark"] .saved-item:hover,html[data-theme="dark"] .team-config-switch:hover,html[data-theme="dark"] .team-member-option:hover,html[data-theme="dark"] .weekly-report-card:hover,html[data-theme="dark"] .weekly-seller-option:hover,html[data-theme="dark"] .manager-seller-nav:hover,html[data-theme="dark"] .manager-back-button:hover{
  background:var(--theme-surface-2)!important;
  border-color:var(--theme-line-strong)!important;
}
html[data-theme="dark"] .team-config-note{
  background:#26282B!important;
  color:var(--theme-muted)!important;
  border-color:var(--theme-line)!important;
}
html[data-theme="dark"] .weekly-performance-identity,
html[data-theme="dark"] .referral-details-inner{
  background:linear-gradient(90deg,#232528,#202124)!important;
}
html[data-theme="dark"] .sale-form{
  background:rgba(23,24,26,.92)!important;
  border-bottom-color:var(--theme-line)!important;
}

/* Tabelas */
html[data-theme="dark"] #appView table td{
  border-color:#28292D;
  color:#cbd7e1;
}
html[data-theme="dark"] #appView table tbody tr:hover td{background:#1E1F22}
html[data-theme="dark"] .referral-main-row>td{
  background:var(--theme-surface)!important;
  color:#cbd7e1!important;
  border-color:#28292D!important;
}
html[data-theme="dark"] .referral-main-row:hover>td,
html[data-theme="dark"] .referral-main-row:focus>td{background:#1E1F22!important}
html[data-theme="dark"] .weekly-task-row:nth-child(odd):not(.header),
html[data-theme="dark"] .weekly-challenge-row:nth-child(odd):not(.header):not(.total),
html[data-theme="dark"] .weekly-task-table-integrated .weekly-task-row:nth-child(odd):not(.header){
  background:#222326!important;
}
html[data-theme="dark"] .weekly-task-table-integrated .weekly-task-cell.current-day{
  background:rgba(58,115,237,.08)!important;
}

/* Texto que no tema claro usa azul-marinho como tinta */
html[data-theme="dark"] .seller-selection-field select,html[data-theme="dark"] .manager-seller-select select,html[data-theme="dark"] .seller-selection-step,html[data-theme="dark"] .manager-seller-nav{color:var(--theme-text-strong)}
html[data-theme="dark"] .seller-selection-step,
html[data-theme="dark"] .manager-seller-nav{
  background:var(--theme-surface)!important;
  border-color:var(--theme-line)!important;
}
html[data-theme="dark"] .content :where(.home-activity-copy,.weekly-report-card){color:var(--theme-text)}

/* Estados sem perder semântica */
html[data-theme="dark"] .audit-icon-trigger.pending,html[data-theme="dark"] .audit-status.pending,html[data-theme="dark"] .audit-icon-option.pending,html[data-theme="dark"] .referral-audit-trigger.pending,html[data-theme="dark"] .referral-audit-static.pending,html[data-theme="dark"] .weekly-task-state.pending{
  background:rgba(212,138,25,.14)!important;
  color:#e7b457!important;
  border-color:rgba(212,138,25,.28)!important;
}
html[data-theme="dark"] .audit-icon-trigger.not-ok,html[data-theme="dark"] .audit-status.not-ok,html[data-theme="dark"] .audit-icon-option.not-ok,html[data-theme="dark"] .referral-audit-trigger.cancelled,html[data-theme="dark"] .referral-audit-static.cancelled,html[data-theme="dark"] .referral-row-icon.danger,html[data-theme="dark"] .referral-row-icon.error,html[data-theme="dark"] .weekly-task-state.missed,html[data-theme="dark"] .receipt-button.empty{
  background:rgba(217,80,80,.13)!important;
  color:#ff858b!important;
  border-color:rgba(217,80,80,.28)!important;
}
html[data-theme="dark"] .audit-icon-trigger.ok,
html[data-theme="dark"] .audit-status.ok,
html[data-theme="dark"] .audit-icon-option.ok{
  background:rgba(36,153,104,.14)!important;
  color:#60cf9b!important;
  border-color:rgba(36,153,104,.3)!important;
}
html[data-theme="dark"] .payment-badge.boleto,html[data-theme="dark"] .daily-period .period-metric-icon{
  background:rgba(58,115,237,.14)!important;
  color:#618EF0!important;
}
html[data-theme="dark"] .profile-performance-row:nth-child(2) .profile-performance-icon{background:rgba(58,115,237,.14);color:#618EF0}
html[data-theme="dark"] .weekly-task-state.future,
html[data-theme="dark"] .weekly-task-state.not-assigned{background:#2A2B2F!important;color:#8092a3!important}
html[data-theme="dark"] .weekly-challenge-row.today{background:rgba(58,115,237,.07)!important}
html[data-theme="dark"] .weekly-challenge-row.total{background:rgba(58,115,237,.12)!important}

/* Ações e popovers */
html[data-theme="dark"] .toolbar-action:hover,
html[data-theme="dark"] .audit-icon-option:hover{
  background:var(--theme-surface-2)!important;
  border-color:var(--theme-line-strong)!important;
  color:var(--theme-text-strong)!important;
}
html[data-theme="dark"] .advanced-filter-trigger{background:var(--theme-surface);color:#a7b7c6;border-color:var(--theme-line)}
html[data-theme="dark"] .advanced-filter-trigger.is-active{background:rgba(58,115,237,.11);color:#618EF0;border-color:rgba(58,115,237,.3)}
html[data-theme="dark"] .current-receipt{background:rgba(36,153,104,.07);border-color:rgba(36,153,104,.22)}
html[data-theme="dark"] .current-receipt-actions button{background:var(--theme-surface-2);border-color:var(--theme-line);color:#a8b8c7}
html[data-theme="dark"] .team-member-option:has(input:checked){background:rgba(62,153,221,.12);border-color:rgba(91,169,228,.46)}
html[data-theme="dark"] .weekly-task-toggle{background:#202124!important;border-color:#60788e!important;color:#91a3b3}
html[data-theme="dark"] .weekly-assigned-task button{background:rgba(217,80,80,.13);color:#ff858b}

/* Cabeçalhos escuros e cartões de destaque continuam com identidade da marca */
html[data-theme="dark"] .weekly-today-focus,html[data-theme="dark"] .weekly-task-row.header,html[data-theme="dark"] .weekly-challenge-row.header,html[data-theme="dark"] .referrals-table th{color:#fff}
html[data-theme="dark"] .weekly-today-focus p,html[data-theme="dark"] .weekly-today-focus small{color:rgba(255,255,255,.76)!important}
html[data-theme="dark"] .weekly-today-focus h3,html[data-theme="dark"] .weekly-today-focus strong{color:#fff!important}

/* Canvas não precisa de fundo próprio; Chart.js recebe cores do tema via JS */
html[data-theme="dark"] canvas{color:var(--chart-text)}

/* Transição curta, sem animar layout */
html[data-theme="dark"] body,
html[data-theme="dark"] .app-shell,
html[data-theme="dark"] .content,
html[data-theme="dark"] .profile-drawer,
html[data-theme="dark"] .chart-panel,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea{
  transition:background-color .18s ease,color .18s ease,border-color .18s ease;
}

/* Refinamento de contraste e hierarquia tipográfica
   Evita azul-escuro como tinta sobre superfícies azuladas/escuras. */

/* 1. Títulos principais: máximo contraste, sem competir com os resultados */
html[data-theme="dark"] #appView .content h1,
html[data-theme="dark"] #appView .content h2{
  color:var(--theme-heading);
}

/* 2. Títulos de seção e subtítulos estruturais */
html[data-theme="dark"] #appView .content h3,
html[data-theme="dark"] #appView .content h4{
  color:var(--theme-subheading);
}
html[data-theme="dark"] .profile-section-heading strong,
html[data-theme="dark"] .advanced-filter-head strong,
html[data-theme="dark"] .weekly-definition-modal-section-head strong{
  color:var(--theme-subheading)!important;
}

/* 3. Nomes de pessoas, equipes e entidades: claros e neutros */
html[data-theme="dark"] .profile-identity>strong,html[data-theme="dark"] .team-member-option strong,html[data-theme="dark"] .weekly-assigned-task strong,html[data-theme="dark"] .weekly-performance-identity strong,html[data-theme="dark"] .weekly-report-card>span strong,html[data-theme="dark"] .weekly-report-task-list strong,html[data-theme="dark"] .weekly-report-card .weekly-report-seller{
  color:var(--theme-name)!important;
}

/* 4. Valores e resultados: primeiro plano visual */
html[data-theme="dark"] .sales-stat strong,html[data-theme="dark"] .period-metric strong,html[data-theme="dark"] .weekly-challenge-row>strong,html[data-theme="dark"] .weekly-report-summary strong,html[data-theme="dark"] .weekly-seller-overview-metrics strong{
  color:var(--theme-result)!important;
}

/* Valores financeiros e totais de maior importância usam o destaque de destaque */
html[data-theme="dark"] .money-cell,html[data-theme="dark"] .referral-money{
  color:var(--theme-result-accent)!important;
}

/* 5. Rótulos, descrições e contexto ficam deliberadamente em segundo plano */
html[data-theme="dark"] .sales-stat span,html[data-theme="dark"] .period-metric span,html[data-theme="dark"] .weekly-report-summary span,html[data-theme="dark"] .weekly-seller-overview-metrics span{
  color:var(--theme-label)!important;
}

/* 6. Textos antes azul-marinho que não são títulos/resultados */
html[data-theme="dark"] .weekly-week-actions strong,html[data-theme="dark"] .weekly-task-row>strong,html[data-theme="dark"] .current-receipt strong,html[data-theme="dark"] .receipt-limit strong,html[data-theme="dark"] .receipt-drop strong{
  color:var(--theme-subheading)!important;
}

/* 7. Azul fica reservado para ação/seleção, em versão luminosa e legível */
html[data-theme="dark"] .manager-back-button,
html[data-theme="dark"] .team-config-switch.active,
html[data-theme="dark"] .current-receipt-actions button:hover,
html[data-theme="dark"] .toolbar-action:hover{
  color:var(--theme-link)!important;
}
html[data-theme="dark"] .period-metric-icon{
  background:#2B2C30!important;
  color:#93c5fd!important;
}

/* 8. Estados positivos continuam verdes, não voltam para o azul */

/* 9. Botões/ícones utilitários que ainda herdavam azul escuro */
html[data-theme="dark"] .sale-action-options button,
html[data-theme="dark"] .referral-audit-options button,
html[data-theme="dark"] .referral-row-icon{
  background:#292A2E!important;
  color:#a9c7dd!important;
}

/* 10. Inputs transparentes específicos precisam herdar a tinta clara */
html[data-theme="dark"] .team-member-search input{
  color:var(--theme-result)!important;
}

/* Cabeçalhos sobre fundos institucionais continuam brancos puros */
html[data-theme="dark"] .weekly-today-focus h3,html[data-theme="dark"] .weekly-today-focus strong,html[data-theme="dark"] .weekly-task-row.header>*,html[data-theme="dark"] .weekly-challenge-row.header>*,html[data-theme="dark"] .referrals-table th{
  color:#fff!important;
}

/* Auditoria visual dark mode v2
   Polimento transversal dos módulos e integração real das superfícies escuras. */

/* Acento institucional uniforme nos cabeçalhos dos setores */
html[data-theme="dark"] :is(
  .sales-command,
  .dashboard-head,
  .seller-dashboard-head,
  .referrals-head,
  .teams-minimal-head,
  .fca-head,
  .weekly-head){
  position:relative;
  border-bottom-color:var(--theme-line)!important;
}
html[data-theme="dark"] :is(
  .sales-command,
  .dashboard-head,
  .seller-dashboard-head,
  .referrals-head,
  .teams-minimal-head,
  .fca-head,
  .weekly-head)::after{
  content:"";
  position:absolute;
  left:0;
  bottom:-1px;
  width:64px;
  height:2px;
  border-radius:999px;
  background:linear-gradient(90deg,var(--theme-orange),#88AAF4);
  box-shadow:0 0 14px rgba(58,115,237,.15);
}
html[data-theme="dark"] .eyebrow,
html[data-theme="dark"] .sales-center-label{
  color:#88AAF4!important;
}

/* Linhas e divisórias não ficam azul-acinzentadas demais */
html[data-theme="dark"] :is(
  .home-section-heading,
  .saved-dashboards-panel,
  .manager-seller-toolbar,
  .fca-section-title,
  .weekly-task-manager,
  .weekly-integrated-heading,
  .weekly-manager-context,
  .weekly-assigned-section){
  border-color:var(--theme-line)!important;
}

/* Laranja como foco de navegação visual, sem dominar o conteúdo */

/* INÍCIO */

/* DASHBOARD */
html[data-theme="dark"] .dashboard-period-panel{
  background:linear-gradient(180deg,#222326,#1C1D20)!important;
  border-color:var(--theme-line)!important;
}
html[data-theme="dark"] .weekly-seller-progress,html[data-theme="dark"] .weekly-manager-progress{
  background:#2D2F33!important;
}

/* VENDAS — tabela principal */
html[data-theme="dark"] .sales-table-wrap{
  border-top-color:var(--theme-orange)!important;
  border-bottom-color:var(--theme-line)!important;
  background:var(--theme-deep)!important;
  box-shadow:0 10px 30px rgba(0,0,0,.18);
}
html[data-theme="dark"] .sales-table th{
  background:rgba(19,20,21,.97)!important;
  color:#aebdcc!important;
  border-bottom-color:#383A3F!important;
  box-shadow:inset 0 -1px 0 rgba(255,255,255,.02);
}
html[data-theme="dark"] .sales-table td{
  background:#202124;
  color:#d2dde6;
  border-bottom-color:#2A2B2F;
}
html[data-theme="dark"] .sales-table td small{color:#8799aa!important}
html[data-theme="dark"] .sales-date-value{color:#d6e0e8!important}
html[data-theme="dark"] .sales-table tbody .sale-main-row{
  background:#202124!important;
  border-color:#313338!important;
  box-shadow:0 6px 18px rgba(0,0,0,.13)!important;
}
html[data-theme="dark"] .sales-table tbody .sale-main-row:hover,
html[data-theme="dark"] .audit-only-table .sale-main-row:hover{
  background:#26272B!important;
  box-shadow:inset 3px 0 0 rgba(58,115,237,.7),0 6px 20px rgba(0,0,0,.16)!important;
}
html[data-theme="dark"] .sales-table tbody .sale-main-row:hover>td{
  background:#26272B!important;
}
html[data-theme="dark"] .sales-table tbody .sale-main-row>td::before{
  color:#8296a7!important;
}

/* VENDAS — linha oculta/expandida: uma camada de detalhes integrada */
html[data-theme="dark"] .sale-details-row td,
html[data-theme="dark"] .sale-details-row td[colspan="9"]{
  background:var(--theme-deep)!important;
}
html[data-theme="dark"] .sale-details-row .sale-details-spacer{
  background:var(--theme-deep)!important;
  border-bottom-color:#2F3035!important;
}
html[data-theme="dark"] .sale-details-inner,
html[data-theme="dark"] .audit-only-table .sale-details-row .sale-details-inner{
  position:relative;
  background:
    linear-gradient(90deg,rgba(58,115,237,.11) 0,rgba(58,115,237,.045) 8%,rgba(26,26,29,.98) 22%,#1C1D20 100%)!important;
  border:1px solid #2F3135!important;
  border-left:3px solid var(--theme-orange)!important;
  border-top:0!important;
  border-radius:0 0 11px 11px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.018),0 8px 22px rgba(0,0,0,.10);
}
html[data-theme="dark"] .sale-details-inner span{
  color:#d2dce5!important;
}
html[data-theme="dark"] .sale-details-inner b{
  color:#88AAF4!important;
}
html[data-theme="dark"] .sales-empty-row td{
  background:#1C1D20!important;
}
html[data-theme="dark"] .sales-add-button{
  box-shadow:0 8px 22px rgba(58,115,237,.15);
}
html[data-theme="dark"] .audit-overview{color:#99aaba}
html[data-theme="dark"] .audit-overview strong{color:#dbe4ec}
html[data-theme="dark"] .receipt-back-button,
html[data-theme="dark"] .sale-action-options,
html[data-theme="dark"] .audit-icon-options{
  background:#222326!important;
  border-color:#35363B!important;
}
html[data-theme="dark"] .receipt-back-button:hover{background:#212225!important}
html[data-theme="dark"] .receipt-preview-canvas{
  background:#1A1B1D!important;
  border-color:#323439!important;
}
html[data-theme="dark"] .receipt-drop,
html[data-theme="dark"] .receipt-drop-direct{
  background:#202124!important;
  border-color:#42444A!important;
  color:#a9b9c8!important;
}
html[data-theme="dark"] .receipt-drop:hover,
html[data-theme="dark"] .receipt-drop.dragging,
html[data-theme="dark"] .receipt-drop-direct:hover{
  background:rgba(58,115,237,.07)!important;
  border-color:var(--theme-accent-border)!important;
}
html[data-theme="dark"] .receipt-empty-state{
  border-color:#3A3C42!important;
  color:#8698a8!important;
}
html[data-theme="dark"] .receipt-empty-state strong{color:#d4dee7!important}
html[data-theme="dark"] .sale-sync-state.syncing{
  background:#2B2C30!important;color:#a7c6dc!important;
}

/* INDICAÇÕES */
html[data-theme="dark"] .referrals-table-scroll{
  background:var(--theme-deep)!important;
  border-color:var(--theme-line)!important;
  border-top:2px solid var(--theme-orange)!important;
}
html[data-theme="dark"] .referral-main-row>td{background:#202124!important}
html[data-theme="dark"] .referral-main-row:hover>td,
html[data-theme="dark"] .referral-main-row:focus>td{
  background:#26272B!important;
}
html[data-theme="dark"] .referral-details-row td[colspan="6"]{background:var(--theme-deep)!important}
html[data-theme="dark"] .referral-details-inner{
  border-left:3px solid var(--theme-orange);
  background:linear-gradient(90deg,rgba(58,115,237,.09),#222326 18%,#1C1D20)!important;
}
html[data-theme="dark"] .referral-details-inner span{color:#d0dbe4!important}
html[data-theme="dark"] .referral-details-inner b{color:#88AAF4!important}

/* TIMES */

/* FCA */
html[data-theme="dark"] .weekly-task-row:not(.header),
html[data-theme="dark"] .weekly-challenge-row:not(.header){
  border-color:#303136!important;
}
html[data-theme="dark"] .weekly-task-row:hover:not(.header),
html[data-theme="dark"] .weekly-challenge-row:hover:not(.header){
  background:#26272B!important;
}
html[data-theme="dark"] .weekly-task-table-integrated .weekly-task-cell.current-day{
  background:rgba(58,115,237,.11)!important;
  box-shadow:inset 2px 0 0 rgba(58,115,237,.28),inset -2px 0 0 rgba(58,115,237,.12);
}
html[data-theme="dark"] .weekly-challenge-row.today{
  background:linear-gradient(90deg,rgba(58,115,237,.12),rgba(58,115,237,.035))!important;
}
html[data-theme="dark"] .weekly-report-card{
  border-color:#2C2E32!important;
}
html[data-theme="dark"] .weekly-report-card:hover{
  background:#26272B!important;
}

/* COMISSÕES */

/* INDICADORES */

/* Perfil e controles: o destaque também identifica o estado ativo */

/* Barra mobile precisa pertencer ao tema escuro */
@media (max-width:900px){
  html[data-theme="dark"] .global-top-controls::before{
    background:linear-gradient(180deg,rgba(11,11,13,.99),rgba(11,11,13,.91) 72%,rgba(11,11,13,0))!important;
  }
}

/* Estados de foco mais coerentes com a nova hierarquia */
html[data-theme="dark"] #appView :is(input,select,textarea):focus{
  border-color:rgba(56,113,237,.62)!important;
  box-shadow:0 0 0 3px rgba(58,115,237,.11)!important;
}

/* Fechamento da auditoria de resíduos claros */
html[data-theme="dark"] .teams-inline-notice{
  background:linear-gradient(90deg,rgba(58,115,237,.13),#1B1C1E)!important;
  color:#ADC4F7!important;
  border:1px solid rgba(58,115,237,.22);
  box-shadow:0 8px 24px rgba(0,0,0,.17);
}
html[data-theme="dark"] .sheet-sync-chip.pending{
  background:rgba(212,138,25,.14)!important;
  color:#e9b65d!important;
}
html[data-theme="dark"] .sheet-sync-chip.error{
  background:rgba(217,80,80,.14)!important;
  color:#ff858b!important;
}
