/* [NIMO-ORIGEM-V1] Tela "Origem dos Leads" (origem/painel/web). Só classes .or-*, com as variáveis de cor, raio e
   altura de controle que o painel já define; os valores depois da vírgula são reserva para a página de prévia. */
.or-raiz {
  --or-confirmada: var(--primary, #00346e);
  --or-site: var(--primary-light, #058fcb);
  --or-sem: #8a8a93;
  --or-ok: #1a9e4c;
  --or-aviso: #b45309;
  --or-erro: #c62828;
  --or-borda: var(--border, #e4e4e7);
  --or-fundo: var(--bg-card, #fff);
  --or-tinta: var(--text-primary, #09090b);
  --or-tinta2: var(--text-secondary, #495057);
  --or-tinta3: var(--text-muted, #6c757d);
  --or-raio: var(--radius, 12px);
  --or-raio-p: var(--radius-sm, 8px);
  --or-controle: var(--altura-controle, 36px);
  color: var(--or-tinta);
  font-variant-numeric: tabular-nums;
}

/* Abas */
.or-abas { display: flex; gap: 4px; border-bottom: 1px solid var(--or-borda); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; }
.or-aba {
  appearance: none; background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 10px 14px; font: inherit; font-weight: 500; color: var(--or-tinta3); cursor: pointer; white-space: nowrap;
}
.or-aba:hover { color: var(--or-tinta); }
.or-aba[aria-selected="true"] { color: var(--or-confirmada); border-bottom-color: var(--or-confirmada); font-weight: 600; }
.or-raiz :focus-visible { outline: 2px solid var(--or-site); outline-offset: 2px; border-radius: 4px; }

/* Cartão e títulos */
.or-cartao { background: var(--or-fundo); border: 1px solid var(--or-borda); border-radius: var(--or-raio); padding: 18px; margin-bottom: 16px; }
.or-cartao-topo > h2 { margin: 0; font-size: 15px; font-weight: 700; }
.or-cartao-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 12px; }
.or-nota { font-size: 12.5px; color: var(--or-tinta3); line-height: 1.5; margin: 0; }
.or-nota + .or-nota { margin-top: 4px; }
.or-duas { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.or-duas > .or-cartao { margin-bottom: 0; min-width: 0; }
.or-duas { margin-bottom: 16px; }

/* Período */
.or-periodo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.or-grupo { display: inline-flex; max-width: 100%; border: 1px solid var(--or-borda); border-radius: var(--or-raio-p); overflow: hidden; overflow-x: auto; scrollbar-width: none; background: var(--or-fundo); }
.or-grupo button {
  appearance: none; border: 0; background: none; font: inherit; font-size: 13px; color: var(--or-tinta2);
  height: calc(var(--or-controle) - 2px); padding: 0 12px; cursor: pointer; border-left: 1px solid var(--or-borda); white-space: nowrap; flex: none;
}
.or-grupo button:first-child { border-left: 0; }
.or-grupo button:hover { background: rgba(0, 52, 110, .05); }
.or-grupo button[aria-pressed="true"] { background: var(--or-confirmada); color: #fff; }
.or-periodo input[type="date"] {
  height: var(--or-controle); border: 1px solid var(--or-borda); border-radius: var(--or-raio-p); padding: 0 10px;
  font: inherit; font-size: 13px; color: var(--or-tinta); background: var(--or-fundo);
}
.or-periodo span { font-size: 13px; color: var(--or-tinta3); }

/* A frase e a faixa: o denominador escrito e desenhado */
.or-frase { font-size: 22px; line-height: 1.3; font-weight: 600; letter-spacing: -.01em; margin: 0 0 14px; max-width: 34em; }
.or-faixa { display: flex; gap: 2px; height: 16px; margin-bottom: 12px; }
.or-seg {
  appearance: none; border: 0; padding: 0; min-width: 6px; height: 100%; cursor: pointer; position: relative;
  flex: 1 1 0; border-radius: 0;
}
.or-seg:first-child { border-radius: 4px 0 0 4px; }
.or-seg:last-child { border-radius: 0 4px 4px 0; }
.or-seg:only-child { border-radius: 4px; }
.or-seg[data-s="confirmada"] { background: var(--or-confirmada); }
.or-seg[data-s="site"] { background: var(--or-site); }
.or-seg[data-s="sem_origem"] { background: var(--or-sem); }
.or-seg::after {
  content: attr(data-dica); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  background: var(--or-tinta); color: #fff; font-size: 12px; line-height: 1.3; padding: 6px 9px; border-radius: 6px;
  white-space: nowrap; pointer-events: none; opacity: 0; z-index: 5;
}
.or-seg:first-child::after { left: 0; transform: none; }
.or-seg:last-child::after { left: auto; right: 0; transform: none; }
.or-seg:hover::after, .or-seg:focus-visible::after { opacity: 1; }
.or-legenda { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-bottom: 12px; }
.or-leg {
  appearance: none; display: inline-flex; align-items: baseline; gap: 8px; font: inherit; font-size: 13px; cursor: pointer;
  background: none; border: 1px solid transparent; border-radius: var(--or-raio-p); padding: 6px 10px 6px 8px; color: var(--or-tinta);
  text-align: left;   /* botão centraliza o texto por padrão: rótulo que quebra em duas linhas (360 px) ficava no meio */
}
.or-leg:hover { border-color: var(--or-borda); }
.or-leg[aria-pressed="true"] { border-color: var(--or-tinta3); background: rgba(9, 9, 11, .03); }
.or-leg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; align-self: center; }
.or-leg b { font-weight: 600; }
.or-leg span { color: var(--or-tinta3); }

/* Tabelas */
.or-rolagem { overflow-x: auto; }
.or-tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
.or-tabela th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--or-tinta3); padding: 8px 10px;
  border-bottom: 1px solid var(--or-borda); white-space: nowrap;
}
.or-tabela td { padding: 9px 10px; border-bottom: 1px solid var(--or-borda); vertical-align: middle; }
.or-tabela tr:last-child td { border-bottom: 0; }
.or-tabela .or-n { text-align: right; white-space: nowrap; }
.or-tabela th.or-n { text-align: right; }
.or-link { appearance: none; background: none; border: 0; padding: 0; font: inherit; color: var(--or-tinta); cursor: pointer; text-align: left; }
.or-link:hover { color: var(--or-confirmada); text-decoration: underline; }
.or-sub { display: block; font-size: 12px; color: var(--or-tinta3); max-width: 36ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.or-corta { max-width: 30ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.or-barra { width: 100%; min-width: 60px; height: 8px; background: rgba(9, 9, 11, .05); border-radius: 0 4px 4px 0; }
.or-barra span { display: block; height: 100%; min-width: 2px; background: var(--or-confirmada); border-radius: 0 4px 4px 0; }
.or-col-barra { width: 34%; }

/* Marcas de situação: sempre ponto + texto, nunca só cor */
.or-marca { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; }
.or-marca i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.or-marca[data-s="confirmada"] i { background: var(--or-confirmada); }
.or-marca[data-s="site"] i { background: var(--or-site); }
.or-marca[data-s="sem_origem"] i { background: none; border: 1.5px solid var(--or-sem); }
.or-etiqueta { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--or-borda); color: var(--or-tinta2); margin-left: 6px; }

/* Filtro ativo, avisos, vazio */
.or-filtro { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; background: rgba(0, 52, 110, .07); color: var(--or-confirmada); border-radius: 999px; padding: 3px 4px 3px 10px; }
.or-filtro button { appearance: none; border: 0; background: none; color: inherit; cursor: pointer; font: inherit; font-size: 15px; line-height: 1; padding: 2px 6px; border-radius: 50%; }
.or-filtro button:hover { background: rgba(0, 52, 110, .12); }
.or-aviso { display: block; font-size: 13px; line-height: 1.5; border: 1px solid var(--or-borda); border-left: 3px solid var(--or-aviso); border-radius: var(--or-raio-p); padding: 10px 12px; margin-bottom: 16px; background: var(--or-fundo); }
.or-aviso[data-t="erro"] { border-left-color: var(--or-erro); }
.or-aviso[data-t="info"] { border-left-color: var(--or-site); }
.or-vazio { padding: 26px 12px; text-align: center; color: var(--or-tinta3); font-size: 13.5px; line-height: 1.5; }
.or-vazio strong { display: block; color: var(--or-tinta); font-size: 15px; margin-bottom: 4px; }
.or-botao {
  appearance: none; height: var(--or-controle); padding: 0 14px; border-radius: var(--or-raio-p); font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; border: 1px solid var(--or-borda); background: var(--or-fundo); color: var(--or-tinta);
}
.or-botao:hover { border-color: var(--or-tinta3); }
.or-botao[data-p] { background: var(--or-confirmada); border-color: var(--or-confirmada); color: #fff; }
.or-botao[data-p]:hover { filter: brightness(1.12); }
.or-centro { text-align: center; margin-top: 10px; }

/* Diagnóstico */
.or-conferencias { list-style: none; margin: 0; padding: 0; }
.or-conferencias li { display: grid; grid-template-columns: 22px 1fr; gap: 2px 10px; padding: 12px 0; border-bottom: 1px solid var(--or-borda); }
.or-conferencias li:last-child { border-bottom: 0; padding-bottom: 0; }
.or-conferencias li:first-child { padding-top: 0; }
.or-conferencias svg { width: 18px; height: 18px; margin-top: 1px; }
.or-conferencias [data-e="ok"] svg { color: var(--or-ok); }
.or-conferencias [data-e="aviso"] svg { color: var(--or-aviso); }
.or-conferencias [data-e="erro"] svg { color: var(--or-erro); }
.or-conferencias [data-e="neutro"] svg { color: var(--or-tinta3); }
.or-conferencias strong { font-size: 13.5px; font-weight: 600; }
.or-conferencias p { grid-column: 2; margin: 0; font-size: 13px; color: var(--or-tinta2); line-height: 1.5; }
.or-numeros { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0; margin: 0; }
.or-numeros div { padding: 2px 16px 2px 0; }
.or-numeros dt { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.or-numeros dd { margin: 2px 0 0; font-size: 12.5px; color: var(--or-tinta2); line-height: 1.45; max-width: 30ch; }

/* Instalação */
.or-passos { list-style: none; counter-reset: or-passo; margin: 0; padding: 0; }
.or-passos > li { counter-increment: or-passo; position: relative; padding: 0 0 22px 40px; }
.or-passos > li:last-child { padding-bottom: 0; }
.or-passos > li::before {
  content: counter(or-passo); position: absolute; left: 0; top: -2px; width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--or-confirmada); color: var(--or-confirmada); font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.or-passos > li::after { content: ""; position: absolute; left: 12.5px; top: 28px; bottom: 2px; width: 1px; background: var(--or-borda); }
.or-passos > li:last-child::after { display: none; }
.or-passos h3 { margin: 0 0 6px; font-size: 14.5px; font-weight: 600; }
.or-passos p { margin: 0 0 8px; font-size: 13px; color: var(--or-tinta2); line-height: 1.55; max-width: 68ch; }
.or-trecho { display: block; width: 100%; box-sizing: border-box; min-height: 104px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; color: var(--or-tinta); background: #f6f7f9; border: 1px solid var(--or-borda); border-radius: var(--or-raio-p); padding: 10px 12px; margin-bottom: 8px; word-break: break-all; }
.or-site-linha { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13px; }
.or-site-linha select { height: var(--or-controle); border: 1px solid var(--or-borda); border-radius: var(--or-raio-p); padding: 0 8px; font: inherit; font-size: 13px; background: var(--or-fundo); color: var(--or-tinta); }
.or-sinal { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--or-tinta2); }
.or-sinal i { width: 8px; height: 8px; border-radius: 50%; background: var(--or-sem); flex: none; }
.or-sinal[data-e="ok"] i { background: var(--or-ok); }
.or-sinal[data-e="aviso"] i { background: var(--or-aviso); }
/* forma do código: três opções exclusivas (rádio de verdade); a linha inteira é o alvo do toque */
.or-formas { border: 0; margin: 0 0 10px; padding: 0; min-width: 0; display: grid; gap: 8px; max-width: 600px; }
.or-forma {
  display: flex; align-items: flex-start; gap: 10px; min-height: 44px; box-sizing: border-box; padding: 10px 12px;
  border: 1px solid var(--or-borda); border-radius: var(--or-raio-p); background: var(--or-fundo); cursor: pointer;
}
.or-forma:hover { border-color: var(--or-tinta3); }
.or-forma:has(input:checked) { border-color: var(--or-confirmada); background: rgba(0, 52, 110, .04); }
.or-forma input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--or-confirmada); cursor: pointer; }
.or-forma > span { min-width: 0; }
.or-forma strong { display: block; font-size: 13.5px; font-weight: 600; }
.or-forma-texto { display: block; font-size: 13px; color: var(--or-tinta2); line-height: 1.5; margin-top: 2px; }
.or-forma-ex { display: block; font-size: 12.5px; color: var(--or-tinta3); line-height: 1.5; margin-top: 4px; }
.or-forma-msg { color: var(--or-tinta); background: #f6f7f9; border: 1px solid var(--or-borda); border-radius: 6px; padding: 0 6px; overflow-wrap: anywhere; }
.or-passos .or-aviso { margin-bottom: 8px; max-width: 600px; box-sizing: border-box; }
.or-aviso[hidden] { display: none; }
.or-eventos { list-style: none; margin: 0; padding: 0; border: 1px solid var(--or-borda); border-radius: var(--or-raio-p); }
.or-eventos li { display: flex; gap: 10px; align-items: baseline; padding: 9px 12px; border-bottom: 1px solid var(--or-borda); font-size: 13px; }
.or-eventos li:last-child { border-bottom: 0; }
.or-eventos time { color: var(--or-tinta3); font-size: 12px; white-space: nowrap; min-width: 64px; }
.or-eventos .or-vazio { padding: 18px 12px; display: block; }
.or-pulso { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--or-ok); margin-right: 6px; animation: or-pulso 1.6s ease-in-out infinite; }
@keyframes or-pulso { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .or-pulso { animation: none; } }

@media (max-width: 640px) {
  .or-frase { font-size: 19px; }
  .or-cartao { padding: 14px; }
  .or-col-barra { display: none; }
  .or-passos > li { padding-left: 34px; }
  /* os cinco atalhos de período cabem numa linha no celular */
  .or-grupo { display: flex; width: 100%; }
  .or-grupo button { flex: 1 1 auto; padding-left: 7px; padding-right: 7px; font-size: 12.5px; }
}
/* enquanto o resumo é trocado: o anterior fica à vista, esmaecido e sem clique */
.or-ocupado { opacity: .55; pointer-events: none; transition: opacity .15s; }
.or-so-leitor { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.or-link.or-de-novo { color: var(--or-confirmada); text-decoration: underline; font-weight: 600; margin-left: 4px; }
.or-botao:disabled { opacity: .6; cursor: default; }
/* tabelas com barra (canal, página): colunas de largura fixa, o nome é que encolhe; nada rola de lado */
.or-tabela-barra { table-layout: fixed; }
.or-tabela-barra th:nth-child(3) { width: 62px; }
.or-tabela-barra th:nth-child(4) { width: 80px; }
.or-tabela-barra .or-col-barra { width: 17%; }
.or-tabela-barra .or-link { display: block; width: 100%; }
/* nome em até duas linhas (canal cabe inteiro; título de página longo corta com reticências) */
.or-tabela-barra .or-corta { max-width: 100%; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.or-tabela-barra .or-sub { max-width: 100%; }
/* Contato da lista: botão que abre o histórico de entradas dele logo abaixo da linha (uma expansão por vez) */
.or-contato {
  appearance: none; background: none; border: 0; margin: 0; padding: 4px 0; font: inherit; color: inherit; text-align: left; cursor: pointer;
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; border-radius: 4px;
}
.or-contato-nome { min-width: 0; }
.or-contato:hover .or-corta { color: var(--or-confirmada); text-decoration: underline; }
.or-seta { flex: none; width: 7px; height: 7px; border-right: 1.5px solid var(--or-tinta3); border-bottom: 1.5px solid var(--or-tinta3); transform: rotate(-45deg); margin: 0 2px; transition: transform .15s; }
.or-contato[aria-expanded="true"] .or-seta { transform: rotate(45deg); border-color: var(--or-confirmada); }
.or-tabela tr:has(> td > .or-contato[aria-expanded="true"]) > td { background: rgba(0, 52, 110, .04); border-bottom-color: transparent; }
.or-tabela .or-ent-linha > td { background: rgba(0, 52, 110, .04); padding: 0 10px 14px; }
.or-entradas { position: sticky; left: 10px; box-sizing: border-box; padding: 4px 0 0 25px; }
.or-entradas .or-nota + .or-nota, .or-ent-lista + .or-nota { margin-top: 8px; }
.or-entradas .or-aviso { margin: 0; }
.or-ent-lista { list-style: none; margin: 0; padding: 0; }
.or-entrada { padding: 10px 0; border-top: 1px solid var(--or-borda); }
.or-entrada:first-child { border-top: 0; padding-top: 2px; }
.or-ent-topo { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.or-ent-topo time { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.or-selo { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--or-borda); color: var(--or-tinta2); background: var(--or-fundo); }
.or-selo[data-selo="origem"] { background: var(--or-confirmada); border-color: var(--or-confirmada); color: #fff; }
.or-ent-dados { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 14px; margin: 6px 0 0; font-size: 12.5px; line-height: 1.45; }
.or-ent-dados dt { color: var(--or-tinta3); }
.or-ent-dados dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.or-ent-dados .or-sub { max-width: 100%; white-space: normal; }
@media (max-width: 640px) {
  .or-contato { min-height: 44px; }
  .or-entradas { padding-left: 0; }
  /* Lista de contatos no celular: quem, quando e situação cabem sem rolar para o lado. O rótulo da situação quebra em
     linhas (largura fixa: sem ela a tabela encolhe a coluna até uma palavra por linha) e a etiqueta desce. */
  .or-tabela td > .or-marca { white-space: normal; width: 112px; align-items: flex-start; line-height: 1.3; }
  .or-tabela td > .or-marca i { margin-top: 4px; }
  .or-tabela td > .or-marca + .or-etiqueta { display: block; width: fit-content; margin: 4px 0 0 14px; }
  /* Nome comprido não empurra a situação para fora da tela: quebra em até duas linhas. */
  .or-contato-nome .or-corta { max-width: 104px; white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
  .or-contato-nome .or-sub { max-width: 104px; }
}
@media (max-width: 380px) {
  #or-contatos .or-tabela th, #or-contatos .or-tabela td { padding-left: 6px; padding-right: 6px; }
  #or-contatos .or-tabela th { white-space: normal; }
  .or-tabela td > .or-marca { width: 98px; }
}
@media (prefers-reduced-motion: reduce) { .or-seta { transition: none; } }
