/* UI-TEMA-03 · superfícies legadas migradas para o bootstrap T1.
 * Cada página continua dona da paleta escura. A camada compartilhada sobrescreve o tema
 * claro e corrige somente o papel secundário escuro que ficou abaixo de AA, além de
 * impressão e preferências de movimento. Não há regra de sessão, API ou negócio aqui. */

html[data-bf-theme="light"]{
  color-scheme:light;
  --bg:#f4f6f8;--card:#fff;--surface:#edf1f5;--border:#d6dde5;--border-2:#aeb9c5;
  --text:#18212b;--muted:#4e5c6c;--muted-2:#5f6f80;
  --gold:#765113;--gold-2:#765113;--success:#176c43;--danger:#b42318;--warn:#765113;--info:#1769aa;--purple:#6b3fa0;
  --success-bg:rgba(23,108,67,.09);--danger-bg:rgba(180,35,24,.08);--warn-bg:rgba(138,90,10,.10);
  --accent-fill:#d4a23f;--accent-fill-hover:#e0b357;--on-accent:#1a1206;
  --shadow:0 1px 2px rgba(24,33,43,.06),0 8px 24px rgba(24,33,43,.08);
}

/* UI-TEMA-20 · a matriz renderizada encontrou --muted-2 em 3,19–3,44:1 nas
 * superfícies escuras. O novo papel mantém a hierarquia abaixo de --muted, mas
 * alcança 4,99:1 até no fundo escuro mais claro (#1b212a). */
html[data-bf-theme="dark"] body[data-bf-surface]{--muted-2:#8490a0}
html[data-bf-theme="dark"] body[data-bf-surface="client"] .sino-badge{color:#1a1206}
html[data-bf-theme="dark"] body[data-bf-surface="crm"] .g-nota{color:#8490a0}

html[data-bf-theme="light"] body[data-bf-surface="auth"]{
  background:radial-gradient(1200px 600px at 50% -10%,#fff 0%,var(--bg) 60%);
}
html[data-bf-theme="light"] body[data-bf-surface="auth"] :is(.box,.card){box-shadow:var(--shadow)}
html[data-bf-theme="light"] body[data-bf-surface="auth"] input{background:#fff;color:var(--text);border-color:var(--border-2)}
html[data-bf-theme="light"] body[data-bf-surface="auth"] :is(button,.btn){background:var(--accent-fill);color:var(--on-accent)}
html[data-bf-theme="light"] body[data-bf-surface="auth"] :is(button,.btn):hover{background:var(--accent-fill-hover)}
html[data-bf-theme="light"] body[data-bf-surface="auth"] .msg.err,
html[data-bf-theme="light"] body[data-bf-surface="auth"] .msg.erro{color:var(--danger);border-color:rgba(180,35,24,.28)}
html[data-bf-theme="light"] body[data-bf-surface="auth"] .msg.ok{color:var(--success);border-color:rgba(23,108,67,.28)}
html[data-bf-theme="light"] body[data-bf-surface="auth"] .brand img{content:url('/baurufer-logo.png')}

html[data-bf-theme="light"] body[data-bf-surface="client"] header,
html[data-bf-theme="light"] body[data-bf-surface="client"] :is(.cli .sair,.sino,.tab,.login-box){background:var(--card)}
html[data-bf-theme="light"] body[data-bf-surface="client"] :is(.tab.on,.bt-acao,.nps-n.on,.nps-send){
  background:var(--accent-fill);border-color:var(--accent-fill);color:var(--on-accent);
}
/* UI-TEMA-15 · o login embutido da Área do Cliente mantém estilo inline legado;
 * o override nominal vence somente fundo e texto do CTA no tema claro. */
html[data-bf-theme="light"] body[data-bf-surface="client"] #l-btn{background:var(--accent-fill)!important;color:var(--on-accent)!important}
html[data-bf-theme="light"] body[data-bf-surface="client"] #l-btn:hover{background:var(--accent-fill-hover)!important}
html[data-bf-theme="light"] body[data-bf-surface="client"] .bar{background:linear-gradient(180deg,var(--accent-fill),var(--accent-fill-hover))}
html[data-bf-theme="light"] body[data-bf-surface="client"] .chip-emp{background:var(--surface)}
html[data-bf-theme="light"] body[data-bf-surface="client"] .et .bola{background:var(--card);color:var(--card)}
html[data-bf-theme="light"] body[data-bf-surface="client"] :is(.et.feito .bola,.et.atual .bola){background:var(--accent-fill);border-color:var(--accent-fill)}
html[data-bf-theme="light"] body[data-bf-surface="client"] :is(input,textarea,select){color:var(--text)}
html[data-bf-theme="light"] body[data-bf-surface="client"] input:-webkit-autofill,
html[data-bf-theme="light"] body[data-bf-surface="client"] input:-webkit-autofill:hover,
html[data-bf-theme="light"] body[data-bf-surface="client"] input:-webkit-autofill:focus{
  -webkit-text-fill-color:var(--text);-webkit-box-shadow:0 0 0 1000px var(--bg) inset;caret-color:var(--text);
}

html[data-bf-theme="light"] body[data-bf-surface="document"] header{background:rgba(255,255,255,.94)}
html[data-bf-theme="light"] body[data-bf-surface="document"] :is(p,li){color:#354353}
html[data-bf-theme="light"] body[data-bf-surface="document"] .note{color:#354353}

html[data-bf-theme="light"] body[data-bf-surface="informativos"] :is(input[type=text],textarea){background:#fff}

/* UI-TEMA-13 · Informativos mantinha o CTA de ciência com --gold escurecido
 * combinado a texto escuro literal. O override fica restrito ao tema claro e
 * ao único botão de confirmação; estados, conteúdo e tema escuro não mudam. */
html[data-bf-theme="light"] body[data-bf-surface="informativos"] .ciencia-confirmar{background:var(--accent-fill);border-color:var(--accent-fill);color:var(--on-accent)}
html[data-bf-theme="light"] body[data-bf-surface="informativos"] .ciencia-confirmar:hover{background:var(--accent-fill-hover)}

/* UI-TEMA-04 · painéis executivos legados. Marketing usa nomes históricos
 * (--panel/--tx/--bd) e Custos/DRE usa os nomes canônicos; os dois conjuntos
 * apontam para os mesmos papéis no tema claro. */
html[data-bf-theme="light"] body[data-bf-surface="executive"]{
  --bg:#f4f6f8;--bg-2:#edf1f5;
  --card:#fff;--surface:#edf1f5;--border:#d6dde5;--border-2:#aeb9c5;
  --text:#18212b;--muted:#4e5c6c;--muted-2:#5f6f80;
  --panel:#fff;--panel2:#edf1f5;--bd:#d6dde5;--bd2:#aeb9c5;
  --tx:#18212b;--mu:#4e5c6c;--mu2:#5f6f80;
  --gold:#765113;--gold-2:#765113;--success:#176c43;--danger:#b42318;--warn:#765113;--info:#1769aa;
  --gr:#176c43;--rd:#b42318;--bl:#1769aa;
}
html[data-bf-theme="light"] body[data-bf-surface="executive"] header{background:rgba(255,255,255,.94)}
html[data-bf-theme="light"] body[data-bf-surface="executive"] :is(input,textarea,select){background:#fff;color:var(--text,var(--tx));border-color:var(--border-2,var(--bd2))}
html[data-bf-theme="light"] body[data-bf-surface="executive"] .aviso{color:#354353}
html[data-bf-theme="light"] body[data-bf-surface="executive"] :is(.card,.conn,.roi,.gstack,.acoes,.mk,.be){box-shadow:var(--shadow)}
html[data-bf-theme="light"] body[data-bf-surface="executive"] .b-yl .vl{color:var(--gold-2)}
html[data-bf-theme="light"] body[data-bf-surface="executive"] .b-yl .dot{background:var(--gold-2)}
html[data-bf-theme="light"] body[data-bf-surface="executive"] .b-neg{color:var(--danger)}
html[data-bf-theme="light"] body[data-bf-surface="executive"] .detalhe-nota{background:var(--surface)}

/* UI-TEMA-19 · a Lista de Demanda conserva no escuro textos claros próprios para
 * sucesso e recusa. No tema claro, mensagens, ações e selos usam os papéis
 * semânticos já medidos, sem alterar estado, decisão ou requests da tela. */
html[data-bf-theme="light"] body[data-bf-surface="executive"][data-tela="demanda"] :is(.msg.ok,.act.buy,.st.comprado){color:var(--success)}
html[data-bf-theme="light"] body[data-bf-surface="executive"][data-tela="demanda"] :is(.msg.err,.act.no,.st.recusado){color:var(--danger)}

/* UI-TEMA-14 · estes CTAs executivos mantinham o --gold escurecido do tema
 * claro combinado a texto escuro literal. A lista nominal preserva controles
 * secundários e o tema escuro; os dois IDs finais precisam vencer estilo inline. */
html[data-bf-theme="light"] body[data-bf-surface="executive"] :is(.pmsave,#conc-form button,.tab[data-v].on,.btn.save,#b.btn){background:var(--accent-fill);border-color:var(--accent-fill);color:var(--on-accent)}
html[data-bf-theme="light"] body[data-bf-surface="executive"] :is(.pmsave,#conc-form button,.tab[data-v].on,.btn.save,#b.btn):hover{background:var(--accent-fill-hover)}
html[data-bf-theme="light"] body[data-bf-surface="executive"] :is(#snAdd,#diAdd){background:var(--accent-fill)!important;color:var(--on-accent)!important}
html[data-bf-theme="light"] body[data-bf-surface="executive"] :is(#snAdd,#diAdd):hover{background:var(--accent-fill-hover)!important}

/* UI-TEMA-16 · o dossiê de Atendimento usa dois CTAs `.bt.pri`: repetir a
 * consulta após falha e entrar como o cliente. O override fica restrito às
 * duas estruturas reais e ao tema claro; personificação e requests não mudam. */
html[data-bf-theme="light"] body[data-bf-surface="executive"] :is(.falha-acoes .bt.pri,.cli-head .acoes .bt.pri){background:var(--accent-fill);border-color:var(--accent-fill);color:var(--on-accent)}
html[data-bf-theme="light"] body[data-bf-surface="executive"] :is(.falha-acoes .bt.pri,.cli-head .acoes .bt.pri):hover{background:var(--accent-fill-hover)}

/* UI-TEMA-17 · os avanços de intenção do vendedor são gerados com estilo inline
 * dourado; a recusa é ação secundária transparente e permanece fora do override. */
html[data-bf-theme="light"] body[data-bf-surface="executive"] button[data-int-id]:not([data-int-estado="recusada"]){background:var(--accent-fill)!important;border-color:var(--accent-fill)!important;color:var(--on-accent)!important}
html[data-bf-theme="light"] body[data-bf-surface="executive"] button[data-int-id]:not([data-int-estado="recusada"]):hover{background:var(--accent-fill-hover)!important}

/* UI-TEMA-18 · a classificação de fornecedores em Custos gera três botões com
 * estilo inline; somente a decisão já selecionada recebe o papel primário claro. */
html[data-bf-theme="light"] body[data-bf-surface="executive"] button[data-aprovar-forn][data-aprovado="true"]{background:var(--accent-fill)!important;border-color:var(--accent-fill)!important;color:var(--on-accent)!important}
html[data-bf-theme="light"] body[data-bf-surface="executive"] button[data-aprovar-forn][data-aprovado="true"]:hover{background:var(--accent-fill-hover)!important}

/* UI-TEMA-11 · a Expedição concentra três modos na mesma página e ainda possui
 * fundos escuros literais. O `data-tela` do shell impede que estes overrides atinjam
 * Marketing, Custos, Compras ou as demais superfícies executivas. */
html[data-bf-theme="light"] body[data-bf-surface="executive"][data-tela="expedicao"] :is(#btnSom,.card h2,.card-summary,th,.modal-box,.modal-head,.toast-novo){background:var(--card);color:var(--text);border-color:var(--border)}
html[data-bf-theme="light"] body[data-bf-surface="executive"][data-tela="expedicao"] th{color:var(--muted)}
html[data-bf-theme="light"] body[data-bf-surface="executive"][data-tela="expedicao"] #btnRefresh{background:var(--accent-fill);border-color:var(--accent-fill);color:var(--on-accent)}
html[data-bf-theme="light"] body[data-bf-surface="executive"][data-tela="expedicao"] #btnRefresh:hover{background:var(--accent-fill-hover)}
html[data-bf-theme="light"] body[data-bf-surface="executive"][data-tela="expedicao"] header a[href="/portal.html"]{color:var(--muted)!important;border-color:var(--border-2)!important}
html[data-bf-theme="light"] body[data-bf-surface="executive"][data-tela="expedicao"] .fr:hover{background:var(--surface)}
html[data-bf-theme="light"] body[data-bf-surface="executive"][data-tela="expedicao"] .t-mu{color:var(--muted);background:var(--surface)}
@keyframes novoPulseClaro{0%,100%{background:var(--surface)}50%{background:var(--card)}}
html[data-bf-theme="light"] body[data-bf-surface="executive"][data-tela="expedicao"] .row-novo{animation-name:novoPulseClaro}

/* UI-TEMA-12 · a Logística define `button.primary` depois desta folha e, no tema claro,
 * combinava o --gold escurecido com texto escuro literal. O escopo corrige somente os três
 * controles primários desta tela; o tema escuro e as demais superfícies não mudam. */
html[data-bf-theme="light"] body[data-bf-surface="executive"][data-tela="logistica"] button.primary:is(#btnAtualizar,#btnSimular,#btnDespesa){background:var(--accent-fill);border-color:var(--accent-fill);color:var(--on-accent)}
html[data-bf-theme="light"] body[data-bf-surface="executive"][data-tela="logistica"] button.primary:is(#btnAtualizar,#btnSimular,#btnDespesa):hover{background:var(--accent-fill-hover)}

/* UI-TEMA-05 · CRM legado. A tela ainda possui uma folha antiga com cores literais;
 * esta camada fica restrita ao tema claro e ao body do CRM, sem tocar no JS/DTO. */
html[data-bf-theme="light"] body[data-bf-surface="crm"]{
  --crm-highlight-text:#765113;--crm-warning-text:#765113;
  --crm-success-text:#176c43;--crm-danger-text:#b42318;
  background:#f4f6f8;color:#18212b;
}
html[data-bf-theme="light"] body[data-bf-surface="crm"] :is(header,.filters-bar,.stats-bar,.gestao,.gestao-sum,.m-box,.m-csv-box){
  background:#fff;border-color:#d6dde5;box-shadow:var(--shadow);
}
html[data-bf-theme="light"] body[data-bf-surface="crm"] :is(.filter-group select,.filter-group input,.seg-trigger,.seg-panel,.seg-search input,.gestao-ctl select,.g-bloco,.detail-panel,.m-head,.m-csv-head,.m-kpi,.funil-menu,#csv-textarea){
  background:#edf1f5;color:#18212b;border-color:#aeb9c5;
}
html[data-bf-theme="light"] body[data-bf-surface="crm"] :is(thead th,table.detail-table thead th,table.g-table th){background:#fff;color:#4e5c6c;border-color:#d6dde5}
html[data-bf-theme="light"] body[data-bf-surface="crm"] :is(tbody tr.main-row,tbody tr.main-row.expanded,tr.detail-row td,table.detail-table tbody tr,table.g-table td){border-color:#d6dde5}
html[data-bf-theme="light"] body[data-bf-surface="crm"] :is(tbody tr.main-row:hover,tbody tr.main-row.expanded,table.detail-table tbody tr:hover td,.seg-item:hover,.compra-clicavel:hover){background:#edf1f5}
html[data-bf-theme="light"] body[data-bf-surface="crm"] :is(header h1,.stat-value,.seg-item,.cliente-nome,.mes-val,.det-item-nome,.m-kpi-val,.gestao-tit,.g-kpi-val,.m-csv-head span,.funil-menu button){color:#18212b}
html[data-bf-theme="light"] body[data-bf-surface="crm"] :is(#periodo-label,.filter-group label,.seg-trigger-arr,.seg-btn,.btn-clear,.stat-label,.regiao-txt,.compra-dt,.detail-title span,.detail-loading,.det-data,.m-close,.m-kpi-lbl,.gestao-ctl label,.g-titulo span,.g-fonte,.g-nota,.g-pill){color:#4e5c6c}
html[data-bf-theme="light"] body[data-bf-surface="crm"] :is(.stat-value.blue,.media-val,.detail-title,.det-preco,.g-titulo,.g-link,.btn-pv){color:#765113}
html[data-bf-theme="light"] body[data-bf-surface="crm"] :is(.stat-value.green,.det-qtde,.compra-val,.g-kpi-val.green,.g-ok,.t-avencer,.btn-bol){color:#176c43}
html[data-bf-theme="light"] body[data-bf-surface="crm"] :is(.stat-value.red,.g-kpi-val.red,.g-venc,.t-vencido){color:#b42318}
html[data-bf-theme="light"] body[data-bf-surface="crm"] [style*="color:#e8ebef"]{color:#18212b!important}
html[data-bf-theme="light"] body[data-bf-surface="crm"] [style*="color:#8a94a3"]{color:#4e5c6c!important}
html[data-bf-theme="light"] body[data-bf-surface="crm"] [style*="background:#1b212a"]{background:#edf1f5!important}
html[data-bf-theme="light"] body[data-bf-surface="crm"] :is(button,input,select,textarea,a,[tabindex]):focus-visible{outline:2px solid #765113;outline-offset:2px}

html[data-bf-theme="light"] body[data-bf-surface="auth"] :is(input,button,.btn,a):focus-visible,
html[data-bf-theme="light"] body[data-bf-surface="client"] :is(input,button,select,textarea,a):focus-visible,
html[data-bf-theme="light"] body[data-bf-surface="document"] :is(input,button,select,textarea,a):focus-visible,
html[data-bf-theme="light"] body[data-bf-surface="informativos"] :is(input,button,select,textarea,a):focus-visible{
  outline:2px solid var(--gold);outline-offset:2px;
}
html[data-bf-theme="light"] body[data-bf-surface="executive"] :is(input,button,select,textarea,a,[tabindex]):focus-visible{
  outline:2px solid var(--gold);outline-offset:2px;
}

@media (prefers-reduced-motion:reduce){
  body[data-bf-surface] *,body[data-bf-surface] *::before,body[data-bf-surface] *::after{
    scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;
  }
}

@media print{
  body[data-bf-surface]{background:#fff!important;color:#111!important}
  body[data-bf-surface] :is(.box,.card,.ped,.kpi,.sec-card,.modal,.bloco,.hero){
    background:#fff!important;color:#111!important;box-shadow:none!important;border-color:#aaa!important;
  }
  body[data-bf-surface="client"] header{position:static!important;background:#fff!important}
  body[data-bf-surface="client"] :is(.tabs,.cli,.sino,.bt-acoes,.nf-acoes,.nps-foot,.acoes-rapidas,.overlay,.login){display:none!important}
  body[data-bf-surface="document"] :is(.navshell-bar,nav.toc,header){display:none!important}
  body[data-bf-surface="document"] .wrap{display:block!important;max-width:none!important;padding:0!important}
  body[data-bf-surface="informativos"] :is(.navshell-bar,.acoes,.filtro){display:none!important}
  body[data-bf-surface="executive"] :is(.navshell-bar,header,.tabs,.acts,.acoes){display:none!important}
  body[data-bf-surface="executive"] main{max-width:none!important;padding:0!important}
  body[data-bf-surface="executive"] :is(.card,.conn,.roi,.gstack,.mk,.be,.exec-card,.goto-exec){
    background:#fff!important;color:#111!important;box-shadow:none!important;border-color:#aaa!important;break-inside:avoid;
  }
  body[data-bf-surface="crm"]{display:block!important;overflow:visible!important;background:#fff!important;color:#111!important}
  body[data-bf-surface="crm"] :is(.navshell-bar,.filters-bar,.header-right,.gestao,.btn-acao,.m-overlay,.m-csv-overlay){display:none!important}
  body[data-bf-surface="crm"] :is(header,.stats-bar,thead th,.detail-panel,.g-bloco){background:#fff!important;color:#111!important;box-shadow:none!important;border-color:#aaa!important}
  body[data-bf-surface="crm"] .table-wrapper{overflow:visible!important}
  body[data-bf-surface="crm"] table{min-width:0!important;font-size:9px!important}
  body[data-bf-surface] :is(p,li,.sub,.muted,.msg,.eyebrow){color:#333!important}
  body[data-bf-surface] a{color:#111!important;text-decoration:underline}
}
