/* etapas.css */
/* Funil de etapas (bolinhas ligadas por traço, estilo CRM33) e lista de etapas (Configurações). Prefixo: et- */

/* ---------- Funil da conversa ---------- */
.et { min-width: 0; }
.et-bolas { display: flex; align-items: flex-start; gap: 0; min-width: 0; }
.et-bola-item {
  position: relative; flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
/* traço entre a bolinha anterior e esta */
.et-bola-item::before {
  content: ""; position: absolute; top: 8px; left: -50%; width: 100%; height: 2px;
  background: var(--line); z-index: 0;
}
.et-bola-item:first-child::before { display: none; }
.et-bola-item.is-feita::before { background: var(--et-cor); }
.et-bola {
  position: relative; z-index: 1; width: 18px; height: 18px; padding: 0; border-radius: 50%;
  border: 2px solid var(--line-strong); background: var(--surface); cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.et-bola:not([aria-disabled="true"]):hover { border-color: var(--et-cor); }
.et-bola:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.et-bola[aria-disabled="true"] { cursor: default; }
.et-bola-item.is-feita .et-bola { background: var(--et-cor); border-color: var(--et-cor); }
.et-bola-item.is-atual .et-bola {
  background: var(--et-cor); border-color: var(--et-cor);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--et-cor) 22%, transparent);
}
.et-bola-nome {
  font-size: var(--fs-1); line-height: 1.2; color: var(--ink-faint); text-align: center;
  max-width: 100%; word-break: keep-all; overflow-wrap: normal; hyphens: none;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.et-nome-curto { display: none; }
.et-bola-item.is-feita .et-bola-nome { color: var(--ink-soft); }
.et-bola-item.is-atual .et-bola-nome { color: var(--ink); font-weight: var(--fw-2); }
.et.is-salvando .et-bolas { opacity: 0.6; transition: opacity var(--dur) var(--ease); }
.et-aviso { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: var(--fs-1); color: var(--ink-faint); }

/* Painel estreito (container, não viewport): troca para rótulo curto com title completo.
 * Nunca quebra palavra: word-break keep-all; quebra só nos espaços. */
.et { container-type: inline-size; }
@container (max-width: 480px) {
  .et-nome-full { display: none; }
  .et-nome-curto { display: -webkit-box; font-size: 11px; }
}

/* ---------- Linha do tempo no estilo do CRM 33 Maringá antigo (design system 90, §3.8) ----------
 * Trilho contínuo + preenchimento proporcional (gradiente + brilho), bolinhas de 28 px com ícone Lucide,
 * feita = cheia na cor da etapa, atual = anel + escala + glow, nome 11 px colorido. Serve à ficha, à conversa e
 * ao orçamento (trilhaEtapas em js/areas/atendimento/etapas.js). O HubMed segue com as bolinhas simples acima. */
.et-trilho { display: none; }
.et-bola svg { display: none; }
.et-esqueleto { height: 44px; }
.et-bolas.is-salvando { opacity: 0.6; transition: opacity var(--dur) var(--ease); }

:root:not([data-visual]) .et-bolas { --et-d: 28px; position: relative; padding-top: 2px; }
:root:not([data-visual]) .et-bolas.is-compacta { --et-d: 24px; }
:root:not([data-visual]) .et-bola-item::before { display: none; }
:root:not([data-visual]) .et-trilho {
  display: block; position: absolute; z-index: 0; height: 4px; border-radius: var(--radius-pill);
  top: calc(2px + var(--et-d) / 2 - 2px); left: calc(50% / var(--et-n, 6)); right: calc(50% / var(--et-n, 6));
  background: var(--tonal-forte);
}
:root:not([data-visual]) .et-trilho-fill {
  display: block; position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit;
  width: calc(var(--et-prog, 0) * 100%);
  background: linear-gradient(90deg, var(--et-cor-ini, var(--et-cor)), var(--et-cor));
  box-shadow: 0 0 10px color-mix(in srgb, var(--et-cor) 55%, transparent);
  transition: width 0.35s var(--ease);
}
:root:not([data-visual]) .et-bola {
  width: var(--et-d); height: var(--et-d); border: 0; display: grid; place-items: center;
  background: var(--surface); color: var(--ink-faint); box-shadow: var(--elev-1);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
:root:not([data-visual]) .et-bola svg { display: block; width: 14px; height: 14px; }
:root:not([data-visual]) .et-bola:not([aria-disabled="true"]):hover {
  border: 0; transform: scale(1.06); color: var(--et-item, var(--et-cor));
  background: color-mix(in srgb, var(--et-item, var(--et-cor)) 12%, var(--surface));
}
:root:not([data-visual]) .et-bola:focus-visible { outline: 0; box-shadow: var(--anel-foco); }
:root:not([data-visual]) .et-bola-item.is-feita .et-bola { background: var(--et-item, var(--et-cor)); border: 0; color: var(--surface); box-shadow: var(--elev-1); }
:root:not([data-visual]) .et-bola-item.is-feita .et-bola:not([aria-disabled="true"]):hover { background: var(--et-item, var(--et-cor)); color: var(--surface); filter: brightness(1.08); }
:root:not([data-visual]) .et-bola-item.is-atual .et-bola {
  background: var(--et-item, var(--et-cor)); color: var(--surface); transform: scale(1.08);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--et-item, var(--et-cor)) 28%, transparent), 0 4px 14px color-mix(in srgb, var(--et-item, var(--et-cor)) 45%, transparent);
}
:root:not([data-visual]) .et-bola-nome { font-size: 11px; font-weight: 600; color: var(--ink-faint); margin-top: 4px; }
:root:not([data-visual]) .et-bola-item.is-feita .et-bola-nome { color: var(--et-item, var(--et-cor)); }
:root:not([data-visual]) .et-bola-item.is-atual .et-bola-nome { color: var(--et-item, var(--et-cor)); font-weight: 700; }
:root:not([data-visual]) .et-bolas.is-compacta .et-bola-nome { display: none; }
:root:not([data-visual]) .et-bolas.is-compacta .et-bola-item.is-atual .et-bola-nome.et-nome-full { display: -webkit-box; }
/* Colunas iguais (grid, não flex: flex-wrap + flex-basis 0 empilhava as bolinhas em width 0 no Chromium) —
 * o trilho (left/right = meia coluna) fica exatamente de centro a centro das bolinhas. */
:root:not([data-visual]) .et-bolas { display: grid; grid-template-columns: repeat(var(--et-n, 6), minmax(var(--et-d), 1fr)); align-items: start; }
:root:not([data-visual]) .et-bola-item { min-width: 0; }
.et-atual-nome { display: none; }
/* Painel estreito (< 400 px): rótulo curto em cada etapa; se o curto não é o nome inteiro, o nome da atual
 * aparece inteiro numa linha ao pé (sempre legível). */
:root:not([data-visual]) .et-nome-full { display: -webkit-box; }
:root:not([data-visual]) .et-nome-curto { display: none; }
@container (max-width: 400px) {
  :root:not([data-visual]) .et-bolas:not(.is-compacta) .et-nome-full { display: none; }
  :root:not([data-visual]) .et-bolas:not(.is-compacta) .et-nome-curto { display: -webkit-box; }
  :root:not([data-visual]) .et-bolas.is-nome-longo:not(.is-compacta) .et-atual-nome {
    display: block; grid-column: 1 / -1; margin-top: 6px; text-align: center; min-width: 0;
    font-size: 12px; font-weight: 700; color: var(--et-item, var(--ink)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
}
/* Painel muito estreito (< 240 px): só as bolinhas; o nome da atual numa linha ao pé. */
@container (max-width: 239px) {
  :root:not([data-visual]) .et-bolas:not(.is-compacta) .et-bola-nome { display: none; }
  :root:not([data-visual]) .et-bolas:not(.is-compacta):not(.is-sem-etapa) .et-atual-nome {
    display: block; grid-column: 1 / -1; margin-top: 6px; text-align: center; min-width: 0;
    font-size: 12px; font-weight: 700; color: var(--et-item, var(--ink)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
}
@media (prefers-reduced-motion: reduce) {
  :root:not([data-visual]) .et-trilho-fill, :root:not([data-visual]) .et-bola { transition: none; }
}

/* ---------- Configurações > Etapas do funil ---------- */
.et-cfg { display: flex; flex-direction: column; gap: 10px; }
.et-cfg-texto { margin: 0; font-size: var(--fs-1); color: var(--ink-soft); }
.et-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.et-linha-cfg {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto 32px; align-items: center; gap: 8px;
  min-height: 40px; padding: 6px 8px 6px 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.et-linha-cfg.is-arrastando { box-shadow: var(--shadow); border-color: var(--accent); }
.et-alca {
  width: 28px; height: 28px; padding: 0; border: 0; background: transparent; border-radius: var(--radius-xs);
  display: grid; place-items: center; cursor: grab; touch-action: none; color: var(--ink-faint);
}
.et-alca:hover { background: var(--surface-soft); }
.et-alca:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.et-alca:active { cursor: grabbing; }
.et-alca-pontos {
  width: 10px; height: 16px;
  background-image: radial-gradient(circle, currentColor 1.5px, transparent 1.8px);
  background-size: 5px 5px;
}
.et-nome-campo { min-width: 0; height: var(--control-h-sm); }
.et-cor { height: var(--control-h-sm); width: auto; max-width: 120px; }
.et-conversas { white-space: nowrap; }
.et-excluir { width: 32px; height: 32px; }
.et-novo { display: flex; gap: 6px; align-items: center; }
.et-novo .input { flex: 1 1 auto; min-width: 0; height: var(--control-h-sm); }
.et-novo .btn { flex: none; }
.et-novo .btn span { white-space: nowrap; }
@media (max-width: 640px) {
  .et-linha-cfg { grid-template-columns: 28px minmax(0, 1fr) 32px; grid-template-areas: "alca nome excluir" "alca cor conv"; row-gap: 4px; }
  .et-linha-cfg .et-alca { grid-area: alca; align-self: stretch; height: auto; }
  .et-linha-cfg .et-nome-campo { grid-area: nome; }
  .et-linha-cfg .et-cor { grid-area: cor; justify-self: start; }
  .et-linha-cfg .et-conversas { grid-area: conv; justify-self: end; }
  .et-linha-cfg .et-excluir { grid-area: excluir; }
}

/* midia.css */
/* Visualizador de mídia do chat (aba secundária da janela da conversa).
 * Só layout e estados; cores vêm de tokens.css. Prefixo: .at-midia */
.at-midia {
  flex: 1; min-height: 0; min-width: 0;
  display: flex; flex-direction: column;
  container-type: inline-size;
  outline: none;
  background: var(--surface);
}
.at-midia-barra {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
}
.at-midia-titulo { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 200px; }
.at-midia-titulo strong { min-width: 0; font-weight: var(--fw-2); font-size: var(--fs-2); }
.at-midia-ico { flex: none; display: inline-flex; color: var(--accent); }
.at-midia-pos { flex: none; font-variant-numeric: tabular-nums; white-space: nowrap; }
.at-midia-ctrl { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; min-width: 0; }
.at-midia-barra .btn-sm { height: var(--control-h-sm); }
/* O download é um link: sem display de botão ele fica 2 px mais alto que os vizinhos. */
.at-midia-baixar { display: inline-flex; align-items: center; justify-content: center; }
/* OCR é uma ação de destaque discreta: mesmo formato dos outros, ícone na cor da marca. */
.at-midia-ocr .ico, .at-midia-ocr svg { color: var(--accent); }
/* A navegação e as ferramentas compartilham a linha sempre que houver espaço. */
:root:not([data-visual]) .at-midia-barra {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  padding: 4px 8px; border-bottom: 0;
}
:root:not([data-visual]) .at-midia-titulo { flex: none; }
:root:not([data-visual]) .at-midia-ctrl { margin-left: auto; }
:root:not([data-visual]) .at-midia-nav { display: flex; align-items: center; gap: 4px; min-width: 0; }
:root:not([data-visual]) .at-midia-nav.is-unica { display: none; }
:root:not([data-visual]) .at-midia-pos:empty { display: none; }
:root:not([data-visual]) .at-midia-ctrl .btn-sm { height: var(--control-h-sm); }
:root:not([data-visual]) .at-midia-ctrl .btn-icon.btn-sm { width: var(--control-h-sm); }
.at-midia-sep { width: 1px; height: 20px; margin: 0 4px; background: var(--line); }
.at-midia-zoom { display: inline-flex; align-items: center; gap: 2px; }
.at-midia-zoom-valor {
  min-width: 52px; height: 30px; padding: 0 6px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--ink-soft); font: inherit; font-size: var(--fs-1);
  font-variant-numeric: tabular-nums; cursor: pointer;
}
:root:not([data-visual]) .at-midia-zoom-valor { height: var(--control-h-sm); }
.at-midia-zoom-valor:hover { background: var(--surface-muted); color: var(--ink); }
.at-midia [hidden] { display: none !important; }

.at-midia-palco { flex: 1; min-height: 0; min-width: 0; display: flex; position: relative; }
.at-midia-vp {
  position: relative; flex: 1; min-width: 0; min-height: 0; overflow: hidden;
  background: var(--surface-muted); cursor: grab; touch-action: none;
}
.at-midia-vp.is-arrastando { cursor: grabbing; }
.at-midia-foto {
  position: absolute; left: 50%; top: 50%;
  max-width: none; max-height: none; user-select: none; -webkit-user-drag: none;
  border-radius: var(--radius-xs); box-shadow: var(--shadow-sm); background: var(--surface);
}
.at-midia-pdf { flex: 1; width: 100%; height: 100%; min-height: 0; border: 0; background: var(--surface-muted); }
.at-midia-pdf-paginas { flex: 1; min-width: 0; overflow: auto; padding: 12px; background: var(--surface-muted); }
.at-midia-pdf-pagina { display: block; max-width: 100%; height: auto; margin: 0 auto 12px; background: #fff; box-shadow: var(--shadow-sm); }
.at-midia-vazio { margin: auto; padding: 24px; color: var(--ink-faint); text-align: center; }

@media (max-width: 767px) {
  .at-midia-barra { padding: 6px 8px; }
  .at-midia-pos { display: none; }
  .at-midia-ctrl { width: 100%; justify-content: space-between; }
  :root:not([data-visual]) .at-midia-pos { display: inline; }
  :root:not([data-visual]) .at-midia-barra { grid-template-columns: minmax(0, 1fr); }
  :root:not([data-visual]) .at-midia-titulo { display: none; }
  :root:not([data-visual]) .at-midia-ctrl { justify-self: stretch; }
  :root:not([data-visual]) .at-midia-nav { grid-row: 2; }
}

@container (max-width: 580px) {
  .at-midia-barra, :root:not([data-visual]) .at-midia-barra { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; padding: 4px 6px; }
  .at-midia-titulo, :root:not([data-visual]) .at-midia-titulo { display: none; }
  .at-midia-nav, :root:not([data-visual]) .at-midia-nav { display: flex; align-items: center; gap: 2px; }
  .at-midia-ctrl, :root:not([data-visual]) .at-midia-ctrl { width: auto; flex: 1 1 auto; justify-content: flex-end; flex-wrap: nowrap; gap: 2px; }
  .at-midia-ctrl [data-anexar] span, .at-midia-ctrl [data-ocr] span { display: none; }
  .at-midia-ctrl [data-anexar], .at-midia-ctrl [data-ocr] { padding-inline: 6px; }
  .at-midia-zoom-valor { min-width: 38px; padding-inline: 2px; }
}
@container (max-width: 340px) {
  .at-midia-pos { display: none; }
  .at-midia-ctrl { flex-wrap: wrap; }
}


/* Barra do visualizador: SEMPRE uma única linha (sem quebra), em qualquer largura.
 * Por padrão os botões com texto cabem; em larguras estreitas viram só ícone (aria-label/title
 * já descrevem a ação) e gaps/fonte encolhem. Valem para os dois CRMs (mesmo design system). */
:root .at-midia .at-midia-barra { flex-wrap: nowrap; overflow: hidden; gap: 6px; white-space: nowrap; }
:root .at-midia .at-midia-nav { flex: none; flex-wrap: nowrap; gap: 4px; }
:root .at-midia .at-midia-pos { font-size: var(--fs-1); }
:root .at-midia .at-midia-ctrl { flex: 1 1 auto; width: auto; flex-wrap: nowrap; justify-content: flex-end; margin-left: auto; gap: 6px; min-width: 0; }
:root .at-midia .at-midia-ctrl > * { flex: none; }
:root .at-midia .at-midia-zoom-valor { min-width: 40px; }
@container (max-width: 760px) {
  :root .at-midia .at-midia-ctrl [data-anexar] span, :root .at-midia .at-midia-ctrl [data-ocr] span { display: none; }
  :root .at-midia .at-midia-ctrl [data-anexar], :root .at-midia .at-midia-ctrl [data-ocr] { padding-inline: 0; width: var(--control-h-sm); }
  :root .at-midia .at-midia-ctrl { gap: 4px; }
}
@container (max-width: 460px) {
  :root .at-midia .at-midia-barra { padding: 4px; gap: 3px; }
  :root .at-midia .at-midia-nav, :root .at-midia .at-midia-ctrl { gap: 3px; }
  :root .at-midia .at-midia-pos { font-size: 11px; }
  :root .at-midia .at-midia-barra .btn-icon.btn-sm, :root .at-midia .at-midia-ctrl [data-anexar], :root .at-midia .at-midia-ctrl [data-ocr] { width: 26px; height: 26px; min-width: 0; }
  :root .at-midia .at-midia-zoom-valor { min-width: 34px; height: 26px; font-size: 11px; }
}
@container (max-width: 340px) {
  :root .at-midia .at-midia-pos { display: none; }
}

/* ajuda.css */
/* Módulo Ajuda: botão do topo, modal e apontador de elemento. */

.ajuda-botao { gap: 6px; }
.ajuda-rotulo { font-size: 13px; }
.ajuda-intro { margin: 0 0 12px; }
.ajuda textarea { width: 100%; resize: vertical; min-height: 92px; }
.ajuda-linha { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.ajuda-detalhes { margin-top: 6px; }
.ajuda-pre {
  max-height: 180px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--tonal);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.ajuda-apontar { gap: 6px; }
.ajuda-banner {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1400;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 24px);
  padding: 4px 4px 4px 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: inherit;
  box-shadow: var(--brilho), var(--elev-3);
  font-size: 13px;
  pointer-events: none; /* só o botão Cancelar recebe o ponteiro; o resto é da página */
}
.ajuda-banner .btn { pointer-events: auto; }
.ajuda-banner-icone { display: inline-flex; flex: none; color: var(--accent); }
.ajuda-banner-texto { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ajuda-banner-dica { flex: none; white-space: nowrap; }
.ajuda-destaque {
  position: fixed;
  z-index: 1350;
  pointer-events: none;
  border: 2px solid var(--accent);
  border-radius: 14px;
  box-shadow: 0 0 0 4px var(--accent-soft), var(--elev-3);
  animation: ajuda-pulso 1s ease-out 1;
}
.ajuda-area {
  position: fixed;
  z-index: 1360;
  pointer-events: none;
  border: 2px solid var(--accent);
  border-radius: 14px;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
@keyframes ajuda-pulso {
  from { box-shadow: 0 0 0 0 var(--accent-soft), var(--elev-3); }
  to { box-shadow: 0 0 0 4px var(--accent-soft), var(--elev-3); }
}
html.ajuda-apontando,
html.ajuda-apontando * { cursor: crosshair !important; }
html.ajuda-apontando { touch-action: none; user-select: none; }

.ajuda-tickets { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow: auto; }
.ajuda-ticket { padding: 10px; border: 0; border-radius: var(--radius-sm); background: var(--textura); box-shadow: var(--brilho), var(--elev-1); }
.ajuda-ticket-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.ajuda-ticket-texto { margin-bottom: 4px; white-space: pre-wrap; word-break: break-word; }
.ajuda-ticket-acoes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ajuda-print { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0; font-size: 13px; }
.ajuda-print input { margin-top: 2px; }
.uso-lista { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow: auto; }
.uso-linha {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-xs);
  background: var(--tonal);
}

@media (max-width: 720px) {
  .ajuda-rotulo { display: none; }
  .ajuda-banner-dica { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ajuda-destaque { animation: none; }
}

/* tema-hubmed.css */
/* Inter local (OFL), subconjuntos latin e latin-ext, pesos variáveis 100-900. */
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* CRM33 Comercial — visual Hubmed.
 * Mesma base (HTML, JS, simulador e base.css); este arquivo só troca a pele para
 * a identidade que os franqueados já usam no Hubmed. Carregado por último e
 * ativado por <html data-visual="hubmed">. Medidas: Design System Hubmed v1.0. */

:root[data-visual="hubmed"] {
  color-scheme: light;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;

  /* Fundo liso do Hubmed (sem foto por unidade); a foto só entra se a pessoa escolheu (regra abaixo) */
  --fundo-img: none;
  --fundo-cor: #f4f4f5;

  /* Superfícies e texto (zinc + shadcn do Hubmed) */
  --surface: #ffffff;
  --surface-soft: #fafafa;
  --surface-muted: #f4f4f5;
  --ink: #18181b;
  --ink-soft: #65758b;
  --ink-faint: #64748b;
  --line: rgba(225, 231, 239, 0.8);
  --line-strong: #e4e4e7;

  /* Ação: indigo Material do Hubmed; cor fixa (a cor por unidade não se aplica) */
  --accent: #3949ab;
  --accent-hover: #303f9f;
  --accent-ink: #ffffff;
  --accent-soft: #e8eaf6;
  --accent-softer: #f3f4fb;
  --navy: #1f2a5b;
  --navy-deep: #001540;
  --cyan: #3dbdec;

  /* Estados com as cores do Hubmed */
  --ok: #059669;      --ok-soft: #ecfdf5;
  --warn: #ffa000;    --warn-soft: #fff8e1;
  --danger: #dc2626;  --danger-soft: #fef2f2;
  --draft: #71717a;   --draft-soft: #f4f4f5;
  --info: #1f2a5b;    --info-soft: #e3f2fd;

  /* Chat */
  --bubble-in: #f0f7ed;
  --bubble-out: #d9fdd3;
  --bubble-note: #fff8e1;
  --thread-bg: #efeae2;
  --ack-read: #1976d2;

  /* Geometria Hubmed */
  --gap: 16px;
  --edge: 0px;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 10px;
  --rail-w: 256px;
  --topbar-h: 80px;
  --control-h: 36px;
  --control-h-sm: 30px;
  --table-row-h: 52px;

  --fw-2: 700;
  --shadow-sm: 0 1px 1px rgba(0, 0, 0, 0.04);
  --shadow-card: none;
  --shadow-card-hover: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-primary: none;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-visual="hubmed"] body { background: var(--fundo-cor); letter-spacing: normal; }

/* ---------- Casca: menu lateral branco + cabeçalho fixo ---------- */
@media (min-width: 768px) {
  [data-visual="hubmed"] .app {
    gap: 0; padding: 0;
    grid-template-columns: var(--rail-w) 1fr;
    grid-template-rows: auto 1fr;
    transition: grid-template-columns 300ms ease-in-out;
  }
  [data-visual="hubmed"] .app.hm-recolhido { --rail-w: 56px; }
  [data-visual="hubmed"] .rail {
    border-radius: 0; box-shadow: none; border-right: 1px solid #e1e7ef;
    align-items: stretch; padding: 0 12px 12px; gap: 2px; position: relative; z-index: 20;
    overflow: visible;
  }
  /* Cabeçalho do menu numa linha só: marca (símbolo), caixa do usuário e recolher */
  [data-visual="hubmed"] .hm-topo {
    position: relative; margin: 0 -12px 10px; padding: 8px 12px;
    border-bottom: 1px solid rgba(225, 231, 239, 0.6);
    display: flex; flex-direction: row; align-items: center; gap: 8px;
  }
  [data-visual="hubmed"] .hm-topo .hm-recolher { position: static; flex: none; box-shadow: none; }
  [data-visual="hubmed"] .hm-topo .rail-logo { flex: none; }
  [data-visual="hubmed"] .hm-topo .hm-marca-texto { display: none; }
  [data-visual="hubmed"] .hm-topo .hm-marca-simbolo { width: 30px; height: 30px; font-size: 13px; }
  [data-visual="hubmed"] .hm-topo .hm-usuario { width: auto; flex: 1 1 0; min-width: 0; padding: 5px 8px; }
  [data-visual="hubmed"] .rail-logo { width: auto; height: auto; margin: 0; padding: 0; background: none; color: var(--navy); border-radius: 8px; }
  [data-visual="hubmed"] .rail-item {
    width: auto; min-height: 36px; height: 36px;
    flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 8px 12px; border-radius: 10px; font-size: 13px; color: var(--ink-soft);
    transition: all 200ms var(--ease);
  }
  [data-visual="hubmed"] .rail-item .ico { width: 18px; height: 18px; }
  [data-visual="hubmed"] .rail-item:hover { background: #f4f4f5; color: #0f1729; }
  [data-visual="hubmed"] .rail-item[aria-current="page"] { background: rgba(31, 42, 91, 0.1); color: var(--navy); font-weight: 500; }
  [data-visual="hubmed"] .rail-item .badge-count { position: static; margin-left: auto; }
  [data-visual="hubmed"] .rail-item[data-pessoa] { display: none; }

  [data-visual="hubmed"] .topbar {
    position: sticky; top: 0; z-index: 10;
    border-radius: 0; box-shadow: none; min-height: var(--topbar-h);
    background: rgba(255, 255, 255, 0.8); backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(225, 231, 239, 0.6);
    padding: 16px 24px 16px 32px; gap: 16px;
  }
  [data-visual="hubmed"] .main { padding: 16px; gap: 16px; }

  /* Menu recolhido: só ícones */
  [data-visual="hubmed"] .app.hm-recolhido .rail-item { justify-content: center; padding: 8px 0; }
  [data-visual="hubmed"] .app.hm-recolhido .rail-item > span:not(.badge-count),
  [data-visual="hubmed"] .app.hm-recolhido .hm-marca-texto,
  [data-visual="hubmed"] .app.hm-recolhido .hm-usuario > div,
  [data-visual="hubmed"] .app.hm-recolhido .hm-usuario > button,
  [data-visual="hubmed"] .app.hm-recolhido .hm-versao { display: none; }
  [data-visual="hubmed"] .app.hm-recolhido .hm-usuario { justify-content: center; padding: 8px 0; }
  [data-visual="hubmed"] .app.hm-recolhido .hm-topo { flex-direction: column; padding: 10px; gap: 6px; }
  [data-visual="hubmed"] .app.hm-recolhido .hm-topo .hm-usuario { flex: none; width: 100%; }
  [data-visual="hubmed"] .app.hm-recolhido .rail-item .badge-count { position: absolute; top: 2px; right: 6px; }
}

/* Marca, usuário, versão e botão de recolher (inseridos por js/temas/hubmed.js) */
.hm-marca { display: flex; align-items: center; justify-content: center; gap: 8px; }
.hm-marca-simbolo {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 14px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--cyan) 100%);
}
.hm-marca-texto { text-align: left; line-height: 1; }
.hm-marca-texto b { display: block; font-size: 22px; font-weight: 900; letter-spacing: -0.5px; color: var(--navy); }
.hm-marca-texto small { display: block; margin-top: 3px; font-size: 7.5px; font-weight: 700; letter-spacing: 0.9px; color: var(--cyan); text-transform: uppercase; }
.hm-usuario {
  width: 100%; font: inherit;
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: #fafafa; border: 1px solid rgba(225, 231, 239, 0.5); border-radius: 12px; cursor: pointer;
  text-align: left; color: var(--ink);
}
.hm-usuario > div { flex: 1; min-width: 0; }
.hm-usuario b { display: block; font-size: 14px; font-weight: 600; color: #0f1729; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-usuario small { display: block; font-size: 11px; font-weight: 600; color: var(--ink-soft); }
.hm-usuario .ico { color: var(--ink-soft); flex: none; }
.hm-recolher {
  position: absolute; right: -10px; bottom: -10px; z-index: 30;
  width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--navy-deep); color: #fff; display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  transition: transform 150ms var(--ease);
}
.hm-recolher:hover { transform: scale(1.1); }
.hm-recolher:active { transform: scale(0.95); }
.hm-versao {
  align-self: center; margin-top: 4px; font-size: 9px; font-weight: 500; color: var(--ink-faint);
  background: none; padding: 0; border: 0; box-shadow: none;
}
@media (max-width: 767px) {
  .hm-topo, .hm-versao, .hm-recolher { display: none !important; }
}

/* Cabeçalho da página: caixa de ícone 48px, título 24/900, subtítulo 13/500 */
.hm-cab-icone {
  width: 48px; height: 48px; border-radius: 16px; flex: none;
  display: grid; place-items: center; color: var(--navy);
  background: #fff; border: 1px solid #f4f4f5; box-shadow: var(--shadow-sm);
}
.hm-cab-textos { display: flex; flex-direction: column; min-width: 0; }
[data-visual="hubmed"] .topbar-title { font-size: 16px; font-weight: 700; letter-spacing: 0; color: #18181b; line-height: 22px; }
.hm-cab-sub { font-size: 13px; font-weight: 500; color: #71717a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 767px) { .hm-cab-icone, .hm-cab-sub { display: none; } [data-visual="hubmed"] .topbar-title { font-size: 18px; } }

/* Selos do cabeçalho viram pontos pequenos (rodada S1): o texto fica no title e no aria-label. */
[data-visual="hubmed"] .demo-tag { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; font-size: 0; background: #ffa000; flex: none; }
[data-visual="hubmed"] .health { gap: 4px; }
/* Semáforo de conexões no estilo HubMed: ponto pequeno e chapado (sem halo); problema vira pílula tingida com o ponto. */
[data-visual="hubmed"] .semaforo { width: 28px; height: 28px; }
[data-visual="hubmed"] .semaforo-ponto { box-shadow: none; }
[data-visual="hubmed"] .semaforo[data-state="warn"] { background: var(--warn-soft); }
[data-visual="hubmed"] .semaforo[data-state="down"] { background: var(--danger-soft); }
[data-visual="hubmed"] .semaforo-detalhe { border-radius: 10px; border-color: #e4e4e7; }

/* ---------- Painéis (cartões brancos do Hubmed) ---------- */
[data-visual="hubmed"] .panel {
  border-radius: var(--radius); border: 1px solid rgba(225, 231, 239, 0.6);
  box-shadow: var(--shadow-sm);
}
[data-visual="hubmed"] .panel-head { border-bottom-color: rgba(225, 231, 239, 0.6); padding: 6px 10px; min-height: 42px; }
[data-visual="hubmed"] .panel-title { font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; color: #27272a; }
[data-visual="hubmed"] .panel-body { padding: 16px; }
[data-visual="hubmed"] .panel-foot { border-top-color: rgba(225, 231, 239, 0.4); background: rgba(250, 250, 250, 0.5); }
[data-visual="hubmed"] .card {
  border-radius: 12px; border-color: rgba(225, 231, 239, 0.8); box-shadow: var(--shadow-card);
  transition: box-shadow 150ms var(--ease), transform 150ms var(--ease);
}

/* ---------- Botões (rodada S1: sem caixa alta, sem sombra) ---------- */
[data-visual="hubmed"] .btn {
  border-radius: 10px; font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0;
  border-color: #e4e4e7; color: #3f3f46; box-shadow: none;
  transition: all 150ms var(--ease);
}
[data-visual="hubmed"] .btn:hover { background: #fafafa; }
[data-visual="hubmed"] .btn:active { transform: scale(0.95); }
[data-visual="hubmed"] .btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: none; }
[data-visual="hubmed"] .btn-primary:hover { background: var(--accent-hover); }
[data-visual="hubmed"] .btn-ghost { box-shadow: none; text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 12px; border-color: transparent; color: var(--ink-soft); }
[data-visual="hubmed"] .btn-ghost:hover { background: #f4f4f5; color: #18181b; }
[data-visual="hubmed"] .btn-danger { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
[data-visual="hubmed"] .btn-danger:hover { background: #fee2e2; }
/* Ícone sem caixa colorida: cinza no repouso, fundo suave no hover; vermelho só no hover de destrutiva. */
[data-visual="hubmed"] .btn-icon:not(.btn-primary) { background: none; border-color: transparent; box-shadow: none; color: var(--ink-soft); }
[data-visual="hubmed"] .btn-icon:not(.btn-primary):hover { background: var(--surface-muted); color: var(--ink); }
[data-visual="hubmed"] .btn-icon.btn-danger:not(.btn-primary):hover { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
[data-visual="hubmed"] .btn:focus-visible, [data-visual="hubmed"] .rail-item:focus-visible, [data-visual="hubmed"] .tab:focus-visible { outline: 2px solid #3f51b5; outline-offset: 2px; }

/* ---------- Campos ---------- */
[data-visual="hubmed"] .input, [data-visual="hubmed"] .select, [data-visual="hubmed"] textarea.input {
  border-radius: 12px; border-color: rgba(225, 231, 239, 0.9); background: rgba(250, 250, 250, 0.6);
  font-size: 13px; font-weight: 500; padding: 0 12px;
}
[data-visual="hubmed"] textarea.input { padding: 8px 12px; }
/* Seta de menu nos selects (a mesma chevron-down da moderna). As regras de campo acima usam "background" abreviado, que apaga a imagem da seta; por isso a seta volta aqui, com mais especificidade e também em :focus. */
[data-visual="hubmed"] :is(select.select, select.input, select.hm-input),
[data-visual="hubmed"] :is(select.select, select.input, select.hm-input):focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a6f68' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px 12px;
}
[data-visual="hubmed"] .input:focus, [data-visual="hubmed"] .select:focus { border-color: #3f51b5; box-shadow: inset 0 0 0 1px #3f51b5; background: #fff; }
[data-visual="hubmed"] .field > label, [data-visual="hubmed"] .label { font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; color: #64748b; }
[data-visual="hubmed"] .search-input .input { border-radius: 12px; background: #fafafa; border-color: #e4e4e7; padding-left: 34px; }
[data-visual="hubmed"] .switch:checked { background: var(--accent); }

/* ---------- Tabelas ---------- */
[data-visual="hubmed"] .table { font-size: 13px; }
[data-visual="hubmed"] .table th {
  background: #fafafa; height: 36px; padding: 0 16px;
  font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none; color: #71717a;
  border-bottom: 1px solid rgba(225, 231, 239, 0.6);
}
[data-visual="hubmed"] .table th.num { text-align: right; }
[data-visual="hubmed"] .table td { padding: 0 16px; border-bottom: 0; font-weight: 500; color: #52525b; }
[data-visual="hubmed"] .table tbody tr:nth-child(even) { background: #fafafa; }
[data-visual="hubmed"] .table tbody tr:hover { background: #f4f4f5; }
[data-visual="hubmed"] .table tbody tr[aria-selected="true"] { background: var(--accent-soft); }

/* ---------- Selos ---------- */
[data-visual="hubmed"] .badge {
  height: 22px; padding: 0 9px; font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0;
  border: 1px solid #e4e4e7; background: #f4f4f5; color: #71717a;
}
[data-visual="hubmed"] .badge-ok { background: #ecfdf5; color: #059669; border-color: #d1fae5; }
/* Texto âmbar do HubMed (#ffa000) sobre #fff8e1 dá 1,9:1; o texto usa âmbar escuro (6:1, AA) e o fundo fica igual. */
[data-visual="hubmed"] .badge-warn { background: #fff8e1; color: #8a5300; border-color: #ffe082; }
[data-visual="hubmed"] .badge-danger { background: #fef2f2; color: #dc2626; border-color: #fee2e2; }
[data-visual="hubmed"] .badge-info { background: #e3f2fd; color: #1f2a5b; border-color: #90caf9; }
[data-visual="hubmed"] .badge-accent { background: #e8eaf6; color: #3949ab; border-color: #c5cae9; }
[data-visual="hubmed"] .badge-count { background: #dc2626; font-weight: 900; font-size: 10px; }

/* ---------- Abas e segmentos ---------- */
[data-visual="hubmed"] .tabs { border-bottom-color: rgba(225, 231, 239, 0.6); padding: 0 12px; gap: 4px; }
[data-visual="hubmed"] .tab { font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; color: #71717a; padding: 0 10px; min-height: 32px; }
[data-visual="hubmed"] .tab:hover { color: #27272a; }
[data-visual="hubmed"] .tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
[data-visual="hubmed"] .seg { border-radius: 12px; background: #f4f4f5; padding: 4px; }
[data-visual="hubmed"] .seg button { border-radius: 10px; font-size: 12px; font-weight: 700; color: #71717a; padding: 6px 12px; }
[data-visual="hubmed"] .seg button[aria-pressed="true"] { color: var(--accent); background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.05), var(--shadow-sm); }

/* Filtros de Orçamentos com as cores dos estados do HubMed (os mesmos tons dos cartões e selos):
 * bolinha de identificação sempre visível e a aba ativa no tom do estado, em vez de tudo cinza. */
[data-visual="hubmed"] .op-sit button { display: inline-flex; align-items: center; gap: 6px; }
[data-visual="hubmed"] .op-sit button::before {
  content: ""; position: static; left: auto; top: auto; transform: none; width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: var(--chip, #a1a1aa); opacity: .55;
}
[data-visual="hubmed"] .op-sit button[aria-pressed="true"]::before { opacity: 1; }
[data-visual="hubmed"] .op-sit [data-sit="todos"] { --chip: #1f2a5b; --chip-soft: #e8eaf6; }
[data-visual="hubmed"] .op-sit [data-sit="aberto"] { --chip: #1976d2; --chip-soft: #e3f2fd; }
[data-visual="hubmed"] .op-sit [data-sit="agendado"] { --chip: #8a5300; --chip-soft: #fbf0dc; }
[data-visual="hubmed"] .op-sit [data-sit="cancelado"] { --chip: #dc2626; --chip-soft: #fef2f2; }
[data-visual="hubmed"] .op-sit [data-sit="finalizado"] { --chip: #059669; --chip-soft: #ecfdf5; }
[data-visual="hubmed"] .op-sit [data-sit="reativar"] { --chip: #c2562c; --chip-soft: #fbe6da; }
[data-visual="hubmed"] .op-sit button[aria-pressed="true"] {
  color: var(--chip); background: var(--chip-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--chip) 30%, transparent);
}
/* Guias: Ativas (verde) e Canceladas (vermelho). Ativa, o botão leva a cor de destaque; inativo, texto escuro
 * legível (antes ficava cinza claro, com a bolinha a 55%). Fundos: tokens --ok-soft e --danger-soft. Texto
 * ativo: verde e vermelho escurecidos (#047857 e #b91c1c), porque --ok e --danger dão 3,5:1 e 4,4:1 em 12 px;
 * o padrão AA pede 4,5:1. A bolinha sai só aqui, para a palavra ficar sem marca antes. */
[data-visual="hubmed"] .hm-guias .op-sit button::before { display: none; }
[data-visual="hubmed"] .hm-guias .op-sit button:not([aria-pressed="true"]) { color: #3f3f46; }
[data-visual="hubmed"] .hm-guias .op-sit [data-sit="emitida"] { --chip: #047857; --chip-soft: var(--ok-soft); }
[data-visual="hubmed"] .hm-guias .op-sit [data-sit="cancelada"] { --chip: #b91c1c; --chip-soft: var(--danger-soft); }
[data-visual="hubmed"] .chip { border-radius: 10px; font-weight: 600; border-color: #e4e4e7; }
[data-visual="hubmed"] .chip[aria-pressed="true"] { background: #e8eaf6; border-color: #c5cae9; color: #3949ab; }

/* ---------- Avatar de inicial (quadrado arredondado indigo) ---------- */
[data-visual="hubmed"] .avatar { border-radius: 12px; background: #e8eaf6; border: 1px solid #c5cae9; color: #3949ab; font-weight: 900; font-size: 12px; }

/* ---------- Vazio ---------- */
[data-visual="hubmed"] .empty { color: #71717a; font-size: 12px; font-weight: 500; }

/* ---------- Modal ---------- */
[data-visual="hubmed"] .modal-backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); }
@media (min-width: 768px) { [data-visual="hubmed"] .modal-backdrop.is-lateral { background: rgba(15, 23, 42, 0.08); backdrop-filter: none; } }
[data-visual="hubmed"] .modal { border-radius: 14px; box-shadow: var(--shadow); animation: hm-zoom 200ms var(--ease); }
[data-visual="hubmed"] .modal-head { background: rgba(250, 250, 250, 0.5); border-bottom-color: rgba(225, 231, 239, 0.6); padding: 12px 14px; }
[data-visual="hubmed"] .modal-head h2 { font-size: 14px; font-weight: 700; letter-spacing: 0; text-transform: none; color: #18181b; }
[data-visual="hubmed"] .modal-body { padding: 20px; }
[data-visual="hubmed"] .modal-body .input, [data-visual="hubmed"] .modal-body .select { height: 40px; background: #fff; }
[data-visual="hubmed"] .modal-foot { background: rgba(250, 250, 250, 0.5); border-top-color: rgba(225, 231, 239, 0.6); padding: 16px; gap: 12px; }
@keyframes hm-zoom { from { opacity: 0; transform: scale(0.95); } }

/* ---------- Menu flutuante e avisos ---------- */
[data-visual="hubmed"] .menu { border-radius: 12px; border-color: rgba(225, 231, 239, 0.8); box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1); padding: 6px; }
[data-visual="hubmed"] .menu button { border-radius: 8px; font-size: 13px; }
[data-visual="hubmed"] .toast { background: #fff; color: #18181b; border: 1px solid rgba(225, 231, 239, 0.8); border-left: 4px solid var(--accent); box-shadow: 0 10px 15px -3px rgba(0,0,0,.1); font-weight: 500; }
[data-visual="hubmed"] .toast[data-variant="error"] { background: #fff; border-left-color: #dc2626; }
[data-visual="hubmed"] .toast[data-variant="ok"] { background: #fff; border-left-color: #059669; }
[data-visual="hubmed"] .toast button { color: var(--accent); font-weight: 700; text-transform: none; font-size: 12px; }
[data-visual="hubmed"] .banner { border-radius: 12px; font-weight: 500; }
[data-visual="hubmed"] .banner-warn { color: #8a5300; }
[data-visual="hubmed"] .palette-item[aria-selected="true"], [data-visual="hubmed"] .palette-item:hover { background: #e8eaf6; }

/* ---------- Login no estilo Hubmed: gradiente navy→ciano e cartão branco ---------- */
[data-visual="hubmed"] .login { background: linear-gradient(90deg, #1f2a5b 0%, #3dbdec 100%) !important; }
[data-visual="hubmed"] .login-card { border-radius: 16px; border: 0; box-shadow: 0 25px 50px -12px rgba(0,0,0,.25); }
[data-visual="hubmed"] .login-card .btn-primary { width: 100%; height: 44px; background: var(--navy); border-color: var(--navy); }
[data-visual="hubmed"] .login-card .input { height: 44px; }
[data-visual="hubmed"] .login-marca .rail-logo { width: 40px; height: 40px; display: grid; place-items: center; font-size: 15px; font-weight: 900; background: linear-gradient(135deg, #1f2a5b, #3dbdec); color: #fff; border-radius: 10px; }
[data-visual="hubmed"] .login-marca .panel-title { font-size: 22px; letter-spacing: -0.5px; text-transform: none; color: var(--navy); }

/* Funil: a trilha de etapas usa o indigo da marca (as cores por etapa seguem nos selos da lista) */
[data-visual="hubmed"] .et-bolas { --et-cor: var(--accent) !important; }
[data-visual="hubmed"] .panel .tabs .tab { padding: 0 8px; letter-spacing: 0; }

/* Títulos de seção das áreas no padrão Hubmed (maiúsculas, peso 900) */
[data-visual="hubmed"] :is(.res-faixa-titulo, .op-ag-dia-titulo, .cfg-sec-titulo, .fi-titulo, .sup-secao, .op-ag-titulo, .cfg-grupo-titulo, .at-midia-titulo) {
  font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; color: #27272a;
}
[data-visual="hubmed"] .cfg-grupo-titulo { font-size: 12px; color: #64748b; }

/* Indicadores como os cartões do Dashboard Hubmed: borda esquerda colorida, rótulo maiúsculo e número 900 */
[data-visual="hubmed"] .res-stats { gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
[data-visual="hubmed"] .res-stat {
  border: 1px solid rgba(225, 231, 239, 0.8); border-left: 3px solid var(--hm-kpi, #3949ab);
  border-radius: 12px; padding: 12px 14px; background: #fff; box-shadow: var(--shadow-card); gap: 4px;
  transition: box-shadow 150ms var(--ease), transform 150ms var(--ease);
}
[data-visual="hubmed"] .res-stat:hover { box-shadow: var(--shadow-card-hover); }
[data-visual="hubmed"] .res-stat:nth-child(5n+1) { --hm-kpi: #059669; }
[data-visual="hubmed"] .res-stat:nth-child(5n+2) { --hm-kpi: #1f2a5b; }
[data-visual="hubmed"] .res-stat:nth-child(5n+3) { --hm-kpi: #ffb300; }
[data-visual="hubmed"] .res-stat:nth-child(5n+4) { --hm-kpi: #3949ab; }
[data-visual="hubmed"] .res-stat:nth-child(5n+5) { --hm-kpi: #dc2626; }
[data-visual="hubmed"] .res-stat-rot { font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none; color: #65758b; }
[data-visual="hubmed"] .res-stat-num { font-size: 22px; font-weight: 900; letter-spacing: -0.4px; color: #18181b; }
[data-visual="hubmed"] .table td:first-child { white-space: nowrap; font-weight: 700; color: #3f3f46; }

/* Ajustes da revisão: tabelas mais justas para não estourar o cartão; rótulos de filtro no padrão */
[data-visual="hubmed"] .table th { padding: 0 12px; font-size: 11px; letter-spacing: 0; }
[data-visual="hubmed"] .table td { padding: 0 12px; }
[data-visual="hubmed"] .table td:first-child { white-space: normal; }
[data-visual="hubmed"] .table-wrap { overflow-x: auto; }
[data-visual="hubmed"] :is(.op-campo, .at-rotulo, .fi-rotulo, .res-funil-rotulo) > span:first-child,
[data-visual="hubmed"] .btn :is(.at-rotulo, .fi-rotulo, .res-funil-rotulo) { color: inherit; }
[data-visual="hubmed"] :is(.at-rotulo, .fi-rotulo, .res-funil-rotulo) {
  font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; color: #64748b;
}
@media (max-width: 767px) {
  :root[data-visual="hubmed"] { --topbar-h: 52px; --gap: 8px; --edge: 6px; }
  [data-visual="hubmed"] .topbar { padding: 0 10px; }
}

/* Menu completo do Hubmed (desktop). O menu original do CRM33 fica só no celular. */
.hm-menu { display: none; }
@media (min-width: 768px) {
  [data-visual="hubmed"] .rail > .rail-item[data-area] { display: none; }
  [data-visual="hubmed"] .rail .rail-spacer { flex: 0; }
  .hm-menu { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; flex: 1; min-height: 0; margin: 0 -6px; padding: 0 6px; }
  .hm-menu-grupo { font-size: 11px; font-weight: 700; letter-spacing: 0; text-transform: none; color: #71717a; padding: 12px 12px 4px; }
  .hm-menu-grupo:first-child { padding-top: 4px; }
  .hm-menu-item {
    display: flex; align-items: center; gap: 12px; min-height: 34px; padding: 7px 12px; border-radius: 10px;
    font-size: 13px; color: #65758b; text-decoration: none; position: relative; transition: all 200ms cubic-bezier(.4,0,.2,1);
  }
  .hm-menu-item .ico { width: 18px; height: 18px; flex: none; }
  .hm-menu-item > span:not(.badge-count) { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hm-menu-item:hover { background: #f4f4f5; color: #0f1729; }
  .hm-menu-item[aria-current="page"] { background: rgba(31, 42, 91, 0.1); color: #1f2a5b; font-weight: 500; }
  .hm-menu-item .badge-count { position: static; }
  [data-visual="hubmed"] .app.hm-recolhido .hm-menu-item { justify-content: center; padding: 7px 0; }[data-visual="hubmed"] .app.hm-recolhido .hm-menu-item > span:not(.badge-count), [data-visual="hubmed"] .app.hm-recolhido .hm-menu-grupo { display: none; }
  [data-visual="hubmed"] .app.hm-recolhido .hm-menu-item .badge-count { position: absolute; top: 0; right: 4px; }
  [data-visual="hubmed"] .rail { padding-bottom: 10px; }
  [data-visual="hubmed"] .hm-versao { margin-top: 8px; flex: none; }
}

/* Revisão 16/10: mesma identidade, navegação por contexto e densidade compacta. */
:root[data-visual="hubmed"] {
  --fs-1: 11px; --fs-2: 12px; --fs-3: 13px; --fs-4: 15px;
  --gap: 10px; --rail-w: 184px; --topbar-h: 56px;
  --control-h: 32px; --control-h-sm: 30px; --table-row-h: 42px;
}
[data-visual="hubmed"] [hidden] { display: none !important; }
[data-visual="hubmed"] .app { grid-template-columns: var(--rail-w) minmax(0, 1fr); grid-template-rows: var(--topbar-h) minmax(0, 1fr); }
[data-visual="hubmed"] .topbar { padding: 10px 16px; gap: 10px; min-width: 0; }
[data-visual="hubmed"] .hm-cab-textos { flex: 1 1 160px; overflow: hidden; }
[data-visual="hubmed"] .topbar-title { overflow: hidden; text-overflow: ellipsis; }
[data-visual="hubmed"] .hm-cab-sub { font-size: 11px; }
[data-visual="hubmed"] [data-sec="campos"] + [data-sec="etapas-topo"] { margin-top: 10px; }
[data-visual="hubmed"] .hm-cab-icone { width: 28px; height: 28px; border-radius: 8px; }
[data-visual="hubmed"] .topbar > .grow { flex: 0; }
[data-visual="hubmed"] .topbar > .btn { flex: 0 1 auto; max-width: 100%; min-width: 32px; }
[data-visual="hubmed"] .topbar .btn .ellipsis { min-width: 0; max-width: 100%; }
[data-visual="hubmed"] .main { padding: 10px; gap: 10px; }
[data-visual="hubmed"] .hm-topo { padding: 8px 12px; gap: 8px; margin-bottom: 8px; }
[data-visual="hubmed"] .hm-marca-texto b { font-size: 20px; }
[data-visual="hubmed"] .hm-usuario b { font-size: 12px; }
[data-visual="hubmed"] .hm-menu { display: flex; flex-direction: column; overflow: auto; flex: 1; min-height: 0; gap: 4px; }
[data-visual="hubmed"] .hm-menu-secao { flex: none; }
[data-visual="hubmed"] .hm-menu-grupo { display: flex; align-items: center; gap: 8px; padding: 9px 8px; margin: 0; cursor: pointer; font-size: 11px; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--ink-soft); list-style: none; border-radius: 8px; }
[data-visual="hubmed"] .hm-menu-grupo::-webkit-details-marker { display: none; }
[data-visual="hubmed"] .hm-menu-grupo > span { flex: 1; }
[data-visual="hubmed"] .hm-menu-grupo > .ico:last-child { transition: transform 150ms var(--ease); }
[data-visual="hubmed"] details:not([open]) > .hm-menu-grupo > .ico:last-child { transform: rotate(-90deg); }
[data-visual="hubmed"] .hm-menu-grupo:hover { background: var(--surface-muted); color: var(--navy); }
[data-visual="hubmed"] .hm-menu-itens { border-left: 1px solid var(--line); margin-left: 9px; padding-left: 3px; }
[data-visual="hubmed"] .hm-menu-item { display: flex; align-items: center; min-height: 32px; gap: 6px; padding: 6px; border-radius: 8px; text-decoration: none; font-size: 12px; color: var(--ink-soft); position: relative; }
[data-visual="hubmed"] .hm-menu-item > span:not(.badge-count) { flex: 1; min-width: 0; overflow: visible; text-overflow: clip; white-space: normal; }
[data-visual="hubmed"] .hm-menu-item:hover { background: var(--surface-muted); }
[data-visual="hubmed"] .hm-menu-item[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 700; box-shadow: inset 2px 0 0 var(--accent); }
[data-visual="hubmed"] .hm-menu-item .ico { width: 16px; height: 16px; flex: none; }
[data-visual="hubmed"] .hm-menu-item .badge-count { position: static; }
[data-visual="hubmed"] .hm-menu-mobile, [data-visual="hubmed"] .hm-menu-fundo { display: none; }
[data-visual="hubmed"] .app.hm-recolhido .hm-menu-grupo { justify-content: center; }
[data-visual="hubmed"] .app.hm-recolhido .hm-menu-grupo > span,
[data-visual="hubmed"] .app.hm-recolhido .hm-menu-grupo > .ico:last-child { display: none; }
[data-visual="hubmed"] .app.hm-recolhido .hm-menu-itens { margin-left: 0; padding-left: 0; border: 0; }
[data-visual="hubmed"] .app.hm-recolhido .hm-menu-grupo { display: flex; }

/* A navegação da área já está no menu principal; não repetir barras de abas.
 * Configurações é a exceção: o menu lateral é a única forma de trocar de seção. */
[data-visual="hubmed"] :is(.cad-abas-painel, .op-tabs, .res-topo) { display: none; }
[data-visual="hubmed"] .cfg-layout { grid-template-columns: 210px minmax(0, 1fr); }
@media (max-width: 900px) { [data-visual="hubmed"] .cfg-layout { grid-template-columns: minmax(0, 1fr); } }
[data-visual="hubmed"] .cfg-painel > .panel-head > .small { display: none; }
[data-visual="hubmed"][data-hm-tela="unidade"] .cfg-painel:not(.cfg-parte) > .panel-head .panel-title { font-size: 0; }
[data-visual="hubmed"][data-hm-tela="unidade"] .cfg-painel:not(.cfg-parte) > .panel-head .panel-title::after { content: "Minha empresa"; font-size: 12px; }

/* Cabeçalhos fluem com suas ações: nunca sobrepor botão ao título. */
[data-visual="hubmed"] :is(.panel-head, .panel-foot) { flex-wrap: wrap; gap: 6px 8px; padding: 6px 10px; min-height: 42px; }
[data-visual="hubmed"] .panel-head > .panel-title { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
[data-visual="hubmed"] :is(.panel-head, .panel-foot) > .btn { flex-shrink: 0; position: relative; }
[data-visual="hubmed"] :is(.panel-head, .panel-foot) > .search-input { min-width: 0; }
[data-visual="hubmed"] .panel-body { padding: 10px 12px; }
[data-visual="hubmed"] .panel-title { font-size: 13px; letter-spacing: 0; line-height: 1.4; margin: 0; }
[data-visual="hubmed"] .btn { max-width: 100%; min-width: 0; }
[data-visual="hubmed"] .btn-sm { padding: 0 8px; font-size: 11px; }
[data-visual="hubmed"] .btn:focus-visible { outline-offset: -2px; }
[data-visual="hubmed"] :is(.input, .select):focus { box-shadow: inset 0 0 0 1px var(--accent); }
[data-visual="hubmed"] .table td { height: var(--table-row-h); font-size: 12px; }
[data-visual="hubmed"] .table th { white-space: normal; }
[data-visual="hubmed"] :is(.table-wrap, .cad-tabela-wrap) { min-width: 0; overflow: auto; }
[data-visual="hubmed"] :is(.cfg-body, .cfg-form, .cfg-campos, .cfg-sec, .op-main, .cad-corpo) { min-width: 0; max-width: 100%; }
[data-visual="hubmed"] .cad-filtros { flex: 1 1 320px; }
[data-visual="hubmed"] .cad-filtros > .search-input { flex: 1 1 140px; min-width: 120px; }
[data-visual="hubmed"] .cad-acoes-linha { gap: 3px; }
[data-visual="hubmed"] .cad-acoes-linha .btn { width: 30px; padding: 0; color: var(--ink-soft); background: none; border-color: transparent; box-shadow: none; }
[data-visual="hubmed"] .cad-acoes-linha .btn:hover { color: var(--accent); background: var(--surface-muted); }
[data-visual="hubmed"] .cad-acoes-linha [data-acao="excluir"]:hover { color: var(--danger); background: var(--danger-soft); }
[data-visual="hubmed"] .hm-hbtn[data-ajustar-guia] {
  color: #3949ab; background: transparent; border-color: #c7d2fe; box-shadow: none;
}
[data-visual="hubmed"] .hm-ajustar-linha { color: #3949ab; background: none; border-color: transparent; box-shadow: none; }
[data-visual="hubmed"] .hm-hbtn[data-ajustar-guia]:hover,
[data-visual="hubmed"] .hm-ajustar-linha:hover { background: #eef2ff; border-color: #a5b4fc; }
[data-visual="hubmed"] .hm-hbtn[data-guia-salvar]:not(:disabled) {
  color: #fff; background: #1f2a5b; border-color: #1f2a5b; opacity: 1;
}
[data-visual="hubmed"] .hm-hbtn[data-guia-salvar]:not(:disabled):hover { background: #182247; border-color: #182247; }
[data-visual="hubmed"] .hm-catalogo { display: flex; flex-direction: column; flex: 1; min-height: 0; }
[data-visual="hubmed"] [data-hm-corrigir][aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
[data-visual="hubmed"] .hm-catalogo-aviso { margin: 0; padding: 8px 12px; background: var(--warn-soft); font-size: 11px; }
[data-visual="hubmed"] .hm-catalogo .cad-ex-nome { min-width: 130px; }
[data-visual="hubmed"] .hm-catalogo .cad-table-ex th:nth-child(5) { display: none; }
[data-visual="hubmed"] .hm-catalogo .cad-table-ex { table-layout: fixed; }
[data-visual="hubmed"] .hm-catalogo .cad-table-ex th:nth-child(1) { width: 84px; }
[data-visual="hubmed"] .hm-catalogo .cad-table-ex th:nth-child(3) { width: 88px; }
[data-visual="hubmed"] .hm-catalogo .cad-table-ex th:nth-child(4) { width: 82px; }
[data-visual="hubmed"] .hm-catalogo .cad-table-ex th:nth-child(6) { width: 106px; }
[data-visual="hubmed"] .hm-catalogo .cad-table-ex th:nth-child(7) { width: 70px; }
[data-visual="hubmed"] .hm-catalogo .cad-table-ex th:nth-child(8) { width: 108px; }
[data-visual="hubmed"] .hm-catalogo .cad-ex-nome .ellipsis { max-width: 100%; }
@media (min-width: 768px) and (max-width: 1200px) {
  [data-visual="hubmed"] .hm-catalogo .cad-table-ex :is(th, td):is(:nth-child(1), :nth-child(3), :nth-child(4)) { display: none; }
}
[data-visual="hubmed"] .modal:has(.hm-precos-modal) { width: min(1100px, calc(100vw - 24px)); }

@media (max-width: 1100px) and (min-width: 768px) {
  :root[data-visual="hubmed"] { --rail-w: 184px; }
  [data-visual="hubmed"] .topbar .demo-tag { display: none; }
  [data-visual="hubmed"] .hm-cab-sub { display: none; }
  [data-visual="hubmed"] .hm-catalogo .cad-filtros { flex-basis: 100%; }
}
@media (max-width: 767px) {
  :root[data-visual="hubmed"] { --topbar-h: 58px; --gap: 8px; }
  [data-visual="hubmed"] .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--topbar-h) minmax(0, 1fr); padding: 0; gap: 0; }
  [data-visual="hubmed"] .topbar { grid-row: 1; grid-column: 1; padding: 6px 8px; border-radius: 0; gap: 6px; overflow: visible; z-index: 30; }
  [data-visual="hubmed"] .main { grid-row: 2; grid-column: 1; padding: 8px; }
  [data-visual="hubmed"] .topbar-title { display: block; font-size: 16px; line-height: 20px; white-space: nowrap; }
  [data-visual="hubmed"] .hm-cab-textos { flex: 1; min-width: 0; }
  [data-visual="hubmed"] .topbar > .btn:has(.ellipsis) { display: none; }
  [data-visual="hubmed"] .topbar > [data-unidade] { display: inline-flex !important; width: 34px; padding: 0; flex: none; }
  [data-visual="hubmed"] .topbar > [data-unidade] > :is(span, .ico:last-child) { display: none; }
  [data-visual="hubmed"] .hm-menu-mobile { display: inline-flex; width: 38px; height: 40px; flex: none; padding: 0; }
  [data-visual="hubmed"] .hm-menu-mobile span { display: none; }
  [data-visual="hubmed"] .rail { display: none; position: fixed; inset: var(--topbar-h) auto 0 0; width: min(208px, calc(100vw - 44px)); z-index: 40; background: var(--surface); border-radius: 0; padding: 12px; flex-direction: column; align-items: stretch; overflow: hidden; box-shadow: var(--shadow); }
  [data-visual="hubmed"] .rail > :is(.rail-item, .rail-spacer) { display: none; }
  [data-visual="hubmed"] .hm-menu { margin: 0; padding: 0; }
  [data-visual="hubmed"] .hm-topo { display: flex !important; flex-direction: column; gap: 8px; padding: 0 0 10px; margin: 0 0 8px; border-bottom: 1px solid var(--line); }
  [data-visual="hubmed"] .hm-topo .rail-logo { display: none; }
  [data-visual="hubmed"] .hm-usuario { min-height: 44px; }
  [data-visual="hubmed"] .hm-menu-grupo { min-height: 42px; }
  [data-visual="hubmed"] .hm-menu-item { min-height: 40px; font-size: 12px; }
  [data-visual="hubmed"] .app.hm-menu-aberto .rail { display: flex; }
  [data-visual="hubmed"] .app.hm-menu-aberto .hm-menu-fundo { display: block; position: fixed; inset: var(--topbar-h) 0 0; z-index: 35; border: 0; background: color-mix(in srgb, var(--navy) 35%, transparent); }
  [data-visual="hubmed"] .app.hm-recolhido .hm-menu-item > span:not(.badge-count),
  [data-visual="hubmed"] .app.hm-recolhido .hm-menu-grupo > span,
  [data-visual="hubmed"] .app.hm-recolhido .hm-menu-grupo > .ico:last-child { display: block; }
  [data-visual="hubmed"] .app.hm-recolhido .hm-menu-item { justify-content: flex-start; padding: 6px 8px; }
  [data-visual="hubmed"] .app.hm-recolhido .hm-menu-grupo { justify-content: flex-start; }
  [data-visual="hubmed"] :is(.panel-head, .panel-foot) { padding: 8px; }
  [data-visual="hubmed"] .panel-head > .panel-title { flex: 1 1 110px; }
  [data-visual="hubmed"] .panel-head .btn-sm { min-height: 34px; }
  [data-visual="hubmed"] .table td { font-size: 11px; }
  [data-visual="hubmed"] .cfg-campos > .field { min-width: 0; flex-basis: 130px; }
  [data-visual="hubmed"] .cfg-linha .btn { white-space: normal; height: auto; min-height: 36px; }
  [data-visual="hubmed"] :is(.cfg-topo, .res-linha-periodo) { flex-wrap: wrap; }
  [data-visual="hubmed"] .cad-filtros { flex-basis: 100%; }
  [data-visual="hubmed"] .hm-catalogo .cad-table-ex :is(th, td):nth-child(4),
  [data-visual="hubmed"] .hm-catalogo .cad-table-ex :is(th, td):nth-child(7) { display: none; }
  [data-visual="hubmed"] .hm-catalogo .cad-ex-nome { min-width: 100px; }
  [data-visual="hubmed"] .hm-catalogo .cad-ex-nome .ellipsis { max-width: 150px; white-space: normal; }
  [data-visual="hubmed"] .hm-catalogo .cad-table-ex .cad-acoes-linha { gap: 2px; }
  [data-visual="hubmed"] .hm-catalogo .cad-table-ex .cad-acoes-linha .btn { width: 28px; }
  [data-visual="hubmed"] .modal { max-width: calc(100vw - 16px); border-radius: 14px; }
  [data-visual="hubmed"] .modal-body { padding: 12px; }
  [data-visual="hubmed"] .modal-foot { padding: 10px; gap: 6px; flex-wrap: wrap; }
  [data-visual="hubmed"] .res-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  [data-visual="hubmed"] .rede-plugins { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  [data-visual="hubmed"] *, [data-visual="hubmed"] *::before, [data-visual="hubmed"] *::after { transition: none !important; animation: none !important; }
}

/* Padrão fixo da HubMed, até a pessoa escolher outra cor ou foto na Aparência rápida. As escolhas
 * (data-hm-cor / data-hm-foto) são gravadas pelo js/areas/hubmed/aparencia-rapida.js e valem por estilo inline. */
:root[data-visual="hubmed"]:not([data-hm-cor]) { --accent: #3949ab !important; --accent-hover: #303f9f !important; --accent-soft: #e8eaf6 !important; }
:root[data-visual="hubmed"]:not([data-hm-foto]) { --fundo-img: none !important; }

/* Aparência rápida (janelinha do controle de conta/tema da HubMed) */
.hm-ap {
  position: fixed; z-index: 60; top: 0; left: 0;
  width: 296px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow: auto;
  box-sizing: border-box; padding: 12px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  font-size: 13px;
}
.hm-ap:focus { outline: none; }
.hm-ap-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.hm-ap-cab b { font-size: 14px; font-weight: 700; color: var(--navy); }
.hm-ap-fechar { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--ink-soft); cursor: pointer; }
.hm-ap-fechar:hover { background: var(--surface-muted); }
.hm-ap-bloco { display: flex; flex-direction: column; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.hm-ap-bloco h3 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink-soft); }
.hm-ap-fotos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.hm-ap-foto { display: flex; flex-direction: column; gap: 4px; padding: 3px; border: 2px solid transparent; border-radius: 10px; background: var(--surface-soft); cursor: pointer; font: inherit; color: var(--ink-soft); }
.hm-ap-foto img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 7px; }
.hm-ap-foto[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.hm-ap-linha { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.hm-ap-solido { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--ink-soft); }
.hm-ap-solido input[type="color"] { width: 32px; height: 26px; padding: 0; border: 1px solid var(--line-strong); border-radius: 6px; background: none; cursor: pointer; }
.hm-ap-solido[data-ativo="true"] { color: var(--accent); }
.hm-ap-cores { display: flex; flex-wrap: wrap; gap: 10px; }
.hm-ap-cor { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 999px; background: var(--sw); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); }
.hm-ap-cor[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.hm-ap-reset, .hm-ap-link { border: 0; background: none; font: inherit; font-size: 12px; font-weight: 600; color: var(--accent); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.hm-ap-reset:disabled { color: var(--ink-faint); cursor: default; }
.hm-ap-reset:not(:disabled):hover, .hm-ap-link:hover { background: var(--surface-muted); }
.hm-ap-rodape { display: flex; justify-content: flex-end; padding-top: 8px; border-top: 1px solid var(--line); }
.hm-ap button:focus-visible, .hm-ap input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Topo HubMed: avatar compacto (iniciais) no lugar do nome cortado; o clique abre o menu da conta
 * (com o "Sair"). O cabeçalho do menu traz o avatar e o nome completo. */
[data-visual="hubmed"] .hm-topo .hm-usuario { width: 34px; height: 34px; min-height: 34px; flex: none; padding: 0; justify-content: center; gap: 0; background: transparent; border-color: transparent; }
[data-visual="hubmed"] .hm-topo .hm-usuario:hover { background: var(--surface-muted); }
.hm-avatar { width: 32px; height: 32px; min-width: 32px; display: grid; place-items: center; border-radius: 10px; font-size: 12px; font-weight: 700; }
[data-visual="hubmed"] .app.hm-recolhido .hm-topo .hm-usuario { width: 34px; height: 34px; }
.hm-menu-cab { display: flex; align-items: center; gap: 10px; padding: 6px 8px 10px; margin: 0 0 6px; border-bottom: 1px solid var(--line); }
.hm-menu-cab-texto { min-width: 0; }
.hm-menu-cab-texto b { display: block; font-size: 13px; font-weight: 600; line-height: 1.25; color: var(--navy); overflow-wrap: anywhere; }
.hm-menu-cab-texto small { display: block; font-size: 11px; color: var(--ink-soft); }
[data-visual="hubmed"] .app.hm-recolhido .hm-menu-cab { display: none; }
[data-visual="hubmed"] .hm-menu-cab-sair { margin-left: auto; flex: none; width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--ink-soft); cursor: pointer; }
[data-visual="hubmed"] .hm-menu-cab-sair:hover { background: var(--surface-muted); color: var(--navy); }

/* Celular: o título da tela tem prioridade; o nome da unidade (unidade única, texto fixo) cede e corta. */
@media (max-width: 767px) {
  [data-visual="hubmed"] .topbar > .hm-cab-textos { flex: 0 0 auto; max-width: 62%; }
  [data-visual="hubmed"] .topbar > .small.muted.ellipsis { flex: 0 1 auto; min-width: 0; font-size: 11px; }
}
@media (max-width: 380px) {
  [data-visual="hubmed"] .topbar > .small.muted.ellipsis { display: none; }
}

/* Lista de conversas (HubMed): duas linhas como no Moderno. Em cima, título e ferramentas; embaixo, as abas (Meus, Fila, Todos). */
[data-visual="hubmed"] .at-lista-topo { flex-wrap: wrap; row-gap: 6px; }
[data-visual="hubmed"] .at-lista-topo > .panel-title { flex: 1 1 auto; }
[data-visual="hubmed"] .at-lista-topo > .tabs { order: 5; flex: 1 0 100%; width: 100%; }

/* hubmed-telas.css */
/* Telas que vieram do Hubmed (área js/areas/hubmed). Medidas do Design System Hubmed v1.0. */
.hm-tela { overflow: hidden; }
.hm-tela-topo { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; flex: none; }
.hm-tela-corpo { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 16px; padding-bottom: 4px; }
.hm-acoes { display: flex; gap: 8px; flex-wrap: wrap; }

.hm-hbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; font: 600 12px var(--font); text-transform: none; cursor: pointer; box-shadow: none; border: 1px solid transparent; transition: all 150ms cubic-bezier(.4,0,.2,1); white-space: nowrap; }
.hm-hbtn:active { transform: scale(.95); }
.hm-hbtn--add { background: #3949ab; color: #fff; border: 0; box-shadow: none; }
.hm-hbtn--add:hover { background: #303f9f; }
.hm-hbtn--navy { background: #1f2a5b; color: #fff; border: 0; box-shadow: none; }
.hm-hbtn--refresh { background: #e3f2fd; color: #1f2a5b; border-color: #90caf9; }
.hm-hbtn--refresh:hover { background: #1f2a5b; color: #fff; }
.hm-hbtn--pdf { background: #fef2f2; color: #3f3f46; border-color: #fecaca; }
.hm-hbtn--pdf .ico { color: #dc2626; }
.hm-hbtn--pdf:hover { background: #fee2e2; }
.hm-hbtn--excel { background: #e8f5e9; color: #1e6d41; font-weight: 700; font-size: 12px; }
.hm-hbtn--excel:hover { background: #c8e6c9; }
.hm-hbtn--warning { background: #fff8e1; color: #ffa000; border-color: #ffe082; letter-spacing: .05em; }
.hm-hbtn--success { background: #059669; color: #fff; border-color: #a7f3d0; letter-spacing: .05em; }
.hm-hbtn--danger { background: #dc2626; color: #fff; border: 0; }
.hm-hbtn--purple { background: #f3e5f5; color: #7b1fa2; border-color: #ce93d8; }
.hm-pilula { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font: 600 11px var(--font); text-transform: none; border: 1px solid; }
.hm-pilula--navy { background: #e3f2fd; border-color: #90caf9; color: #1f2a5b; }
.hm-pilula--verde { background: #ecfdf5; border-color: #a7f3d0; color: #059669; }

.hm-cartao { background: #fff; border: 1px solid rgba(225,231,239,.6); border-radius: 16px; box-shadow: none; }
.hm-barra { padding: 16px; display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; flex: none; }
.hm-busca { position: relative; flex: 1 1 auto; min-width: 0; }
.hm-busca .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #a1a1aa; }
.hm-input { height: 44px; width: 100%; border-radius: 12px; border: 1px solid rgba(225,231,239,.9); background: rgba(250,250,250,.6); padding: 0 14px; font: 500 14px var(--font); color: #18181b; transition: all 150ms; }
.hm-busca .hm-input { padding-left: 40px; }
.hm-input:focus { outline: none; border-color: #3f51b5; box-shadow: inset 0 0 0 1px #3f51b5; background: #fff; }
.hm-campo { display: flex; flex-direction: column; gap: 6px; min-width: 160px; }
.hm-campo > span { font: 700 12px var(--font); color: #64748b; }

.hm-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; flex: none; }
.hm-kpi { --c: #1f2a5b; background: #fff; border: 1px solid rgba(225,231,239,.8); border-left: 3px solid var(--c); border-radius: 12px; padding: 16px 18px; box-shadow: 0 2px 10px -4px rgba(0,0,0,.05); display: flex; flex-direction: column; gap: 6px; transition: box-shadow 150ms, transform 150ms; }
.hm-kpi:hover { box-shadow: 0 4px 20px -4px rgba(0,0,0,.1); }
.hm-kpi.is-destaque { border: 1.5px solid #1f2a5b; border-left-width: 3px; }
.hm-kpi--verde { --c: #059669; } .hm-kpi--navy { --c: #1f2a5b; } .hm-kpi--ambar { --c: #ffb300; } .hm-kpi--vermelho { --c: #dc2626; } .hm-kpi--indigo { --c: #3949ab; } .hm-kpi--azul { --c: #1976d2; }
.hm-kpi-topo { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.hm-kpi-rot { font: 600 12px var(--font); color: #65758b; }
.hm-kpi-ico { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 10%, #fff); flex: none; }
.hm-kpi-valor { font: 900 22px var(--font); letter-spacing: -.4px; color: #18181b; font-variant-numeric: tabular-nums; }
.hm-kpi-sub { font: 500 11px var(--font); color: #64748b; }
.hm-pos { color: #059669; } .hm-neg { color: #dc2626; }
.hm-pilha { display: flex; flex-direction: column; gap: 12px; flex: none; }

.hm-tabela-cartao { padding: 16px; display: flex; flex-direction: column; min-height: 0; flex: none; }
.hm-tabela-wrap { overflow-x: auto; }
.hm-tabela { width: 100%; border-collapse: collapse; font: 500 13px var(--font); color: #52525b; }
.hm-tabela th { background: #fafafa; border-bottom: 1px solid rgba(225,231,239,.6); padding: 10px 12px; text-align: left; font: 600 11px var(--font); letter-spacing: 0; text-transform: none; color: #71717a; white-space: nowrap; }
.hm-tabela td { padding: 12px; height: 56px; }
.hm-tabela tbody tr:nth-child(odd) { background: #fff; }
.hm-tabela tbody tr:nth-child(even), .hm-tabela tbody tr:hover { background: #fafafa; }
.hm-tabela td b { color: #3f3f46; font-weight: 700; }
.hm-tabela tbody tr:hover td b { color: #3949ab; }
.hm-tabela .hm-c { text-align: center; } .hm-tabela .hm-d { text-align: right; }
.hm-tabela tr.is-cancelada { background: #fef2f2 !important; }
.hm-tabela tr.is-cancelada td b { color: #dc2626; font-weight: 900; }
.hm-sub { display: block; font-size: 11px; color: #64748b; font-weight: 500; }

.hm-selo { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font: 600 11px var(--font); text-transform: none; letter-spacing: 0; border: 1px solid; white-space: nowrap; }
.hm-selo--ok { background: #ecfdf5; color: #059669; border-color: #d1fae5; }
.hm-selo--navy { background: #e3f2fd; color: #1f2a5b; border-color: #3dbdec; }
.hm-selo--neutro { background: #f4f4f5; color: #566173; border-color: #e4e4e7; border-radius: 10px; }
.hm-selo--perigo { background: #fef2f2; color: #dc2626; border-color: #fee2e2; }
.hm-selo--aviso { background: #fff8e1; color: #ffa000; border-color: #ffe082; }
.hm-selo--roxo { background: #f3e5f5; color: #7b1fa2; border-color: #e1bee7; }

.hm-avatar { width: 36px; height: 36px; border-radius: 12px; background: #e8eaf6; border: 1px solid #c5cae9; color: #3949ab; font: 900 12px var(--font); display: inline-grid; place-items: center; flex: none; }
.hm-pessoa { display: flex; align-items: center; gap: 12px; }

.hm-acoes-linha { display: inline-flex; gap: 8px; }
/* Ações de linha (rodada S1): ícone sem caixa colorida; cor só no hover (vermelho só na destrutiva). */
.hm-row-action { width: 33px; height: 33px; border-radius: 10px; border: 1px solid transparent; background: none; color: #65758b; display: inline-grid; place-items: center; cursor: pointer; box-shadow: none; transition: all 150ms; }
.hm-row-action:hover { background: #f4f4f5; color: #1f2a5b; }
.hm-row-action--excluir:hover { background: #fef2f2; color: #dc2626; }
.hm-row-action--baixar { color: #65758b; }

.hm-rodape { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; margin-top: 4px; border-top: 1px solid rgba(225,231,239,.4); flex-wrap: wrap; }
.hm-rodape-info { font: 700 12px var(--font); color: #64748b; }
.hm-paginas { display: flex; gap: 4px; }
.hm-pg { min-width: 28px; height: 28px; padding: 0 8px; border-radius: 10px; border: 0; background: transparent; font: 900 11px var(--font); color: #71717a; cursor: pointer; display: inline-grid; place-items: center; }
.hm-pg:hover:not(:disabled) { background: #f4f4f5; }
.hm-pg[aria-current="page"] { background: #1f2a5b; color: #fff; box-shadow: 0 1px 2px #90caf9; }
.hm-pg:disabled { opacity: .35; cursor: default; }

.hm-vazio { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 56px 16px; text-align: center; }
.hm-vazio-ico { width: 64px; height: 64px; border-radius: 50%; background: #fafafa; border: 1px solid #f4f4f5; display: grid; place-items: center; color: #a1a1aa; margin-bottom: 10px; }
.hm-vazio b { font: 600 13px var(--font); text-transform: none; letter-spacing: 0; color: #27272a; }
.hm-vazio span { font: 500 12px var(--font); color: #71717a; }

.hm-segmento { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-muted); }
.hm-segmento button { border: 0; background: none; padding: 8px 14px; border-radius: 10px; font: 700 12px var(--font); color: var(--ink-soft); cursor: pointer; }
.hm-segmento button[aria-pressed="true"] { background: var(--surface); color: var(--seg-ativo); box-shadow: 0 0 0 1px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.05); }

@media (max-width: 767px) {
  .hm-tela-topo { justify-content: flex-start; }
  .hm-hbtn span { display: none; }
  .hm-hbtn { padding: 0 12px; }
}
/* Com botões no cabeçalho, some a etiqueta de demonstração e o seletor de unidade encolhe */
.topbar:has(.hm-no-cab .hm-hbtn) .demo-tag, .topbar:has(.hm-no-cab .hm-hbtn) .health { display: none; }

/* Densidade Hubmed, com ações dentro da própria tela. */
[data-visual="hubmed"] .hm-tela-topo { gap: 6px; }
[data-visual="hubmed"] .hm-tela-topo:has(.hm-acoes:empty):not(:has(.hm-pilula)) { display: none; }
[data-visual="hubmed"] .hm-tela-corpo { gap: 10px; }
[data-visual="hubmed"] .hm-hbtn { height: 34px; padding: 0 12px; font-size: 10px; gap: 6px; border-radius: 10px; }
[data-visual="hubmed"] .hm-barra { padding: 12px; gap: 8px; }
[data-visual="hubmed"] .hm-input { height: 36px; font-size: 12px; }
[data-visual="hubmed"] .hm-campo { min-width: 130px; flex: 0 1 160px; gap: 4px; }
[data-visual="hubmed"] .hm-campo > span { font-size: 12px; }
[data-visual="hubmed"] .hm-tabela-cartao { padding: 10px; }
/* Tabela longa: o cartão usa a altura que sobra e rola nas duas direções, com o cabeçalho fixo.
 * Antes a barra horizontal ficava no fim da lista — era preciso descer a página para achar o scroll. */
[data-visual="hubmed"] .hm-tabela-cartao { flex: 1 1 auto; min-height: 0; }
/* O slot da tabelaViva também precisa ser flex para o cartão caber na altura da tela. */
[data-visual="hubmed"] .hm-tela-corpo > div:has(> .hm-tabela-cartao) { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
[data-visual="hubmed"] .hm-tabela-cartao .hm-tabela-wrap { flex: 1 1 auto; min-height: 0; overflow: auto; }
[data-visual="hubmed"] .hm-tabela thead th { position: sticky; top: 0; z-index: 2; }
/* Em cartão estreito (pela largura do cartão, não da janela) a tabela vira ficha:
 * antes, numa janela média, as 9 colunas não cabiam e a coluna de ações estourava. */
[data-visual="hubmed"] .hm-tabela-cartao { container-type: inline-size; container-name: hm-tabela; }
[data-visual="hubmed"] .hm-tabela { font-size: 12px; }
[data-visual="hubmed"] .hm-tabela th { padding: 10px 8px; font-size: 12px; }
[data-visual="hubmed"] .hm-tabela td { padding: 8px; height: 44px; }
[data-visual="hubmed"] .hm-kpis { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 10px; }
[data-visual="hubmed"] .hm-kpi { padding: 12px; gap: 4px; min-width: 0; }
[data-visual="hubmed"] .hm-kpi-link { color: inherit; text-decoration: none; cursor: pointer; }
[data-visual="hubmed"] .hm-kpi-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[data-visual="hubmed"] .hm-kpi-link:active { transform: translateY(0); }
[data-visual="hubmed"] .hm-ajustar-linha { color: var(--warn); background: var(--warn-soft); }
[data-visual="hubmed"] .hm-orc-guia-coluna .op-acoes { flex-wrap: nowrap; }
[data-visual="hubmed"] .hm-orc-guia-mobile { display: none; }
[data-visual="hubmed"] .hm-contexto-modal:has([data-guia-form]) { height: auto; }
[data-visual="hubmed"] .hm-kpi-rot { font-size: 10px; }
[data-visual="hubmed"] .hm-kpi-valor { font-size: 21px; overflow-wrap: anywhere; }
[data-visual="hubmed"] .hm-kpi-ico { width: 28px; height: 28px; border-radius: 9px; }
[data-visual="hubmed"] .hm-acoes-linha { gap: 5px; }
[data-visual="hubmed"] .hm-row-action { width: 30px; height: 30px; border-radius: 9px; }
[data-visual="hubmed"] .hm-dash-periodo { display: flex; flex-direction: row; align-items: end; flex-wrap: wrap; padding: 10px 12px; gap: 8px; flex: none; }
[data-visual="hubmed"] .hm-dash-periodo > .small { margin-right: auto; align-self: center; }
[data-visual="hubmed"] .hm-dash-periodo .field { flex: 0 1 150px; min-width: 0; }
[data-visual="hubmed"] .hm-dash-periodo .field > span { font-size: 10px; color: var(--ink-soft); }
[data-visual="hubmed"] .hm-dash-grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
[data-visual="hubmed"] .hm-dash-atendimento { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
[data-visual="hubmed"] .hm-dash-atendimento .panel-head { flex-wrap: wrap; gap: 6px 10px; }
[data-visual="hubmed"] .hm-dash-atendimento .panel-head > .small { margin-left: auto; }
[data-visual="hubmed"] .hm-dash-atendimento .panel-title { display: flex; align-items: center; gap: 8px; }
[data-visual="hubmed"] .hm-dash-atendimento .panel-title > .ico { color: var(--accent); }
[data-visual="hubmed"] .hm-atendimento-numeros { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
[data-visual="hubmed"] .hm-atendimento-numero { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 12px; min-width: 0; }
[data-visual="hubmed"] .hm-atendimento-numero:nth-child(2n) { border-left: 1px solid var(--line); }
[data-visual="hubmed"] .hm-atendimento-numero:nth-child(n+3) { border-top: 1px solid var(--line); }
[data-visual="hubmed"] .hm-atendimento-rotulo { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: 10px; }
[data-visual="hubmed"] .hm-atendimento-rotulo .ico { color: var(--accent); flex: none; }
[data-visual="hubmed"] .hm-atendimento-numero > b { font-size: 25px; line-height: 1.25; font-weight: 900; color: var(--navy); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
[data-visual="hubmed"] .hm-atendimento-numero:nth-child(2) > b { color: var(--ok); }
[data-visual="hubmed"] .hm-fila-principal { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
[data-visual="hubmed"] .hm-widget-icone { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--warn); background: var(--warn-soft); flex: none; }
[data-visual="hubmed"] .hm-fila-principal > div { display: flex; flex-direction: column; color: var(--ink-soft); font-size: 11px; }
[data-visual="hubmed"] .hm-fila-principal b { font-size: 30px; line-height: 1.25; font-weight: 900; color: var(--navy); }
[data-visual="hubmed"] .hm-fila-detalhes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-top: 12px; border-top: 1px solid var(--line); gap: 12px; }
[data-visual="hubmed"] .hm-fila-detalhes > div { display: flex; flex-direction: column; gap: 4px; }
[data-visual="hubmed"] .hm-fila-detalhes span { font-size: 10px; color: var(--ink-soft); }
[data-visual="hubmed"] .hm-fila-detalhes b { font-size: 19px; color: var(--navy); }
[data-visual="hubmed"] .hm-fila-equipe { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 14px 0 0; list-style: none; }
[data-visual="hubmed"] .hm-fila-equipe li { display: flex; align-items: center; gap: 8px; font-size: 10px; border-radius: 6px; padding: 5px 8px; background: var(--surface-muted); color: var(--ink-soft); }
[data-visual="hubmed"] .hm-fila-equipe b { color: var(--navy); }
[data-visual="hubmed"] .hm-equipe-ordem { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 10px; }
[data-visual="hubmed"] .hm-equipe-ordem .select { height: 30px; font-size: 11px; }
[data-visual="hubmed"] .hm-dash-bloco { min-height: 0; }
[data-visual="hubmed"] .hm-dash-bloco .panel-body { padding: 12px 14px; }
/* Cartão só com aviso ("sem fonte no contrato ainda") não precisa da altura de um gráfico:
 * vira uma linha só, com o traço ao lado do texto. */
[data-visual="hubmed"] .hm-dash-bloco:has(.empty) .panel-body { padding: 6px 12px; }
[data-visual="hubmed"] .hm-dash-bloco .empty { padding: 6px 8px; flex-direction: row; justify-content: center; gap: 6px; }
[data-visual="hubmed"] .hm-dash-barras { display: flex; flex-direction: column; gap: 12px; padding: 0; margin: 0; list-style: none; }
[data-visual="hubmed"] .hm-dash-barras li > div { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; }
[data-visual="hubmed"] .hm-dash-barras progress { display: block; height: 6px; width: 100%; margin-top: 5px; appearance: none; border: 0; border-radius: 9px; overflow: hidden; background: var(--accent-soft); }
[data-visual="hubmed"] .hm-dash-barras progress::-webkit-progress-bar { background: var(--accent-soft); }
[data-visual="hubmed"] .hm-dash-barras progress::-webkit-progress-value { background: var(--accent); border-radius: 9px; }
[data-visual="hubmed"] .hm-contexto-modal { height: min(65dvh, 600px); display: flex; flex-direction: column; }
[data-visual="hubmed"] .modal:has(.hm-contexto-modal) { width: min(950px, calc(100vw - 24px)); }
[data-visual="hubmed"] .hm-guia-busca { padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
[data-visual="hubmed"] .hm-guia-dados { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; }
[data-visual="hubmed"] .hm-dash-exportar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
[data-visual="hubmed"] .topbar:has(.hm-periodo) :is(.demo-tag, .health) { display: none; }
@media (max-width: 767px) {
  [data-visual="hubmed"] .hm-atendimento-numero { padding: 10px 8px; }
  [data-visual="hubmed"] .hm-atendimento-numero > b { font-size: 22px; }
  [data-visual="hubmed"] .hm-equipe-ordem { margin-left: 0; }
  [data-visual="hubmed"] .hm-orc-guia-coluna .op-acoes { flex-wrap: nowrap; }
  [data-visual="hubmed"] .op-table .hm-orc-guia-coluna { display: none; }
  [data-visual="hubmed"] .hm-orc-guia-mobile { display: flex; align-items: center; gap: 6px; }
  [data-visual="hubmed"] .hm-orc-guia-mobile .btn { min-width: 36px; min-height: 36px; }
  [data-visual="hubmed"] .op-table:not(.op-compacto) td { height: auto; min-height: 42px; }
  [data-visual="hubmed"] .topbar:has(.hm-periodo) .hm-cab-textos { flex-basis: 60px; }
}
@media (max-width: 767px) {
  [data-visual="hubmed"] .hm-tela-topo { justify-content: flex-start; }
  [data-visual="hubmed"] .hm-acoes { gap: 6px; }
  [data-visual="hubmed"] .hm-hbtn { min-height: 38px; padding: 0 10px; }
  [data-visual="hubmed"] .hm-hbtn span { display: inline; }
  [data-visual="hubmed"] .hm-barra { padding: 10px; }
  [data-visual="hubmed"] .hm-campo { flex: 1 1 130px; min-width: 0; }
  [data-visual="hubmed"] .hm-input { min-width: 0; }
  [data-visual="hubmed"] .hm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  [data-visual="hubmed"] .hm-kpi { padding: 10px; }
  [data-visual="hubmed"] .hm-kpi-valor { font-size: 19px; }
  [data-visual="hubmed"] .hm-kpi-topo { gap: 4px; }
  [data-visual="hubmed"] .hm-kpi-ico { display: none; }
  [data-visual="hubmed"] .hm-tabela-cartao { padding: 8px; }
  [data-visual="hubmed"] .hm-row-action { width: 36px; height: 36px; }
  [data-visual="hubmed"] .hm-pg { min-width: 34px; height: 34px; }
  [data-visual="hubmed"] .hm-dash-periodo > .small { flex-basis: 100%; }
  [data-visual="hubmed"] .hm-dash-periodo .field { flex: 1 1 120px; }
  [data-visual="hubmed"] .hm-dash-grade { grid-template-columns: minmax(0, 1fr); }
  [data-visual="hubmed"] .hm-dash-bloco { min-height: 0; }
  [data-visual="hubmed"] .hm-segmento { flex-wrap: wrap; max-width: 100%; }
}

/* Catálogo (Exames e Prestadores): aviso da correção, linhas inativas e ações desabilitadas. */
:root[data-visual="hubmed"] .hm-catalogo-aviso { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; border: 1px solid #ffe082; background: #fff8e1; color: #8a5b00; font: 600 12px var(--font); }
:root[data-visual="hubmed"] .hm-tabela tr.hm-inativo { background: var(--surface-2); }
:root[data-visual="hubmed"] .hm-row-action:disabled { opacity: .4; cursor: not-allowed; }

/* Guias (HubMed): busca pelo número e Ajustar numa linha; editor de ajuste sem estilo inline. */
:root[data-visual="hubmed"] .hm-guias-tabela .op-table td[data-label="Ações"] { white-space: nowrap; }
:root[data-visual="hubmed"] .hm-guia-tit-menor { font-size: 16px; }
:root[data-visual="hubmed"] .hm-guia-resultado { margin-top: 16px; }
:root[data-visual="hubmed"] .hm-guia-cartao { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
:root[data-visual="hubmed"] .hm-guia-cabecalho { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
:root[data-visual="hubmed"] .hm-guia-acoes-linha { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }
/* Gestão de guias: o campo do número tem no máximo 280 px (no desktop estava com 420). No celular vale a regra de 200 px, abaixo. */
:root[data-visual="hubmed"] .hm-datas-guias .hm-guia-busca .hm-busca { flex: 0 1 280px; max-width: 280px; }
/* Área vazia de Gestão de guias: uma linha de instrução, sem bloco alto. */
:root[data-visual="hubmed"] .hm-datas-guias .hm-guia-instrucao { margin: 0; padding: 4px; font-size: 13px; line-height: 1.4; color: #71717a; }

/* Dashboard: período no mesmo seletor de Resultados, com aparência HubMed. */
:root[data-visual="hubmed"] .hm-dash-periodo { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 12px; margin-bottom: 10px; }
:root[data-visual="hubmed"] .hm-dash-periodo .res-seg button { font-size: 11px; font-weight: 800; }
:root[data-visual="hubmed"] .hm-dash-esqueleto { height: 130px; border-radius: 12px; background: var(--surface-2, #eef1f6); }

/* HubMed › Guias: ações secundárias (Agenda, Ajustar guia) em contorno, sem cor cheia */
.hm-guias .op-barra .op-hbtn-contorno { background: transparent; color: #1f2a5b; border: 1px solid #c5cbe0; box-shadow: none; }
.hm-guias .op-barra .op-hbtn-contorno:hover { background: #f1f3f9; }

/* ---------- Compacto (27/10): menos espaço vazio, controles na mesma linha ---------- */
[data-visual="hubmed"] .hm-tela-topo { flex-wrap: nowrap; gap: 8px; }
[data-visual="hubmed"] .hm-tela-topo > .hm-acoes { margin-left: auto; flex-wrap: nowrap; }
[data-visual="hubmed"] .hm-tela-corpo { gap: 8px; }
[data-visual="hubmed"] .hm-cartao { border-radius: 12px; }
[data-visual="hubmed"] .hm-barra { padding: 10px 12px; gap: 8px; align-items: flex-end; }
[data-visual="hubmed"] .hm-campo { flex: 0 1 148px; min-width: 118px; }
[data-visual="hubmed"] .hm-input { border-color: #cbd5e1; background: #fff; }
[data-visual="hubmed"] .hm-kpis { gap: 8px; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
[data-visual="hubmed"] .hm-kpi { padding: 10px 12px; border-radius: 10px; gap: 3px; }
[data-visual="hubmed"] .hm-kpi-rot { color: #475569; font-size: 10px; }
[data-visual="hubmed"] .hm-kpi-valor { font-size: 19px; }
[data-visual="hubmed"] .hm-kpi-ico { width: 26px; height: 26px; border-radius: 8px; }
[data-visual="hubmed"] .hm-tabela-cartao { padding: 10px 12px; }
[data-visual="hubmed"] .hm-tabela th { padding: 8px 10px; color: #4b5563; }
[data-visual="hubmed"] .hm-tabela td { padding: 7px 10px; height: 40px; }
[data-visual="hubmed"] .hm-rodape { padding-top: 10px; }
[data-visual="hubmed"] .hm-vazio { padding: 32px 12px; }
[data-visual="hubmed"] .hm-segmento { padding: 3px; }
[data-visual="hubmed"] .hm-segmento button { padding: 6px 12px; }
[data-visual="hubmed"] .cfg-body { max-width: 980px; gap: 12px; }
[data-visual="hubmed"] .cfg-sec { gap: 8px; }
[data-visual="hubmed"] .cfg-form { max-width: none; gap: 8px; }
[data-visual="hubmed"] .cfg-form .field { max-width: 420px; }
[data-visual="hubmed"] .cfg-form .field:has(textarea) { max-width: 100%; }
[data-visual="hubmed"] .cfg-limites { max-width: 720px; }
[data-visual="hubmed"] .cfg-sec .table select.select { min-width: 132px; }
[data-visual="hubmed"] .cfg-grupo { margin-bottom: 6px; }
[data-visual="hubmed"] .cfg-nav { padding: 8px 6px; }

@media (max-width: 900px) {
  [data-visual="hubmed"] .hm-tela-topo { flex-wrap: wrap; }
  [data-visual="hubmed"] .hm-tela-topo > .hm-acoes { margin-left: 0; flex-wrap: wrap; }
  [data-visual="hubmed"] .hm-campo { flex: 1 1 132px; }
}

/* Contraste AA nos textos pequenos (antes #a1a1aa sobre branco ficava em 2,6:1). */
[data-visual="hubmed"] :is(.hm-campo > span, .hm-sub, .hm-kpi-sub, .hm-vazio span, .hm-vazio-ico) { color: #71717a; }
[data-visual="hubmed"] .hm-selo--neutro { color: #52525b; }
[data-visual="hubmed"] .hm-hbtn--warning { color: #b45309; }

/* Relatórios mantêm sua apresentação compacta própria no celular. */
@media (max-width: 767px) {
  /* Relatórios são números: no celular, uma linha compacta por registro. */
  [data-visual="hubmed"] .hm-relatorio .hm-tabela-wrap { display: none; }
  [data-visual="hubmed"] .hm-relatorio .hm-segmento { flex: 1 1 100%; justify-content: space-between; }
}

.hm-rel-mobile { display: none; }
/* Uma regra por largura do cartão evita a disputa entre media/container queries.
 * O conteúdo de cada célula fica em um elemento, sem nós de texto soltos na grade. */
[data-visual="hubmed"] .hm-tabela td > .hm-celula { min-width: 0; overflow-wrap: anywhere; }
[data-visual="hubmed"] .hm-acoes-linha { flex-shrink: 0; align-items: center; }
[data-visual="hubmed"] .hm-row-action { flex: none; }
[data-visual="hubmed"] .hm-row-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[data-visual="hubmed"] .hm-row-action--editar { color: #92400e; }
[data-visual="hubmed"] .hm-rodape-info { color: #64748b; }
@container hm-tabela (max-width: 720px) {
  [data-visual="hubmed"] :where(.hm-tabela-cartao:not(.hm-relatorio)) .hm-tabela { display: block; }
  [data-visual="hubmed"] :where(.hm-tabela-cartao:not(.hm-relatorio)) .hm-tabela :is(tbody, tr, td) { display: block; width: 100%; }
  [data-visual="hubmed"] :where(.hm-tabela-cartao:not(.hm-relatorio)) .hm-tabela thead { display: none; }
  [data-visual="hubmed"] :where(.hm-tabela-cartao:not(.hm-relatorio)) .hm-tabela tr { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
  [data-visual="hubmed"] :where(.hm-tabela-cartao:not(.hm-relatorio)) .hm-tabela td { display: grid; grid-template-columns: minmax(85px, 32%) minmax(0, 1fr); align-items: center; gap: 8px; padding: 4px 0; min-height: 28px; height: auto; text-align: left; overflow-wrap: anywhere; }
  [data-visual="hubmed"] :where(.hm-tabela-cartao:not(.hm-relatorio)) .hm-tabela td::before { content: attr(data-rotulo); font-size: 11px; font-weight: 600; color: var(--ink-soft); text-transform: none; }
  [data-visual="hubmed"] .hm-tabela td > * { min-width: 0; }
  [data-visual="hubmed"] .hm-row-action { width: 36px; height: 36px; }
}
@media (max-width: 767px) {
  [data-visual="hubmed"] .hm-rel-mobile { display: flex; flex-direction: column; gap: 5px; }
  [data-visual="hubmed"] .hm-rel-linha { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 11px; }
  [data-visual="hubmed"] .hm-rel-linha b { font-size: 12px; color: var(--navy); min-width: 82px; }
  [data-visual="hubmed"] .hm-rel-linha span { color: #52525b; }
  [data-visual="hubmed"] .hm-rel-linha i { font-style: normal; font-weight: 800; color: var(--ink-soft); font-size: 11px; text-transform: none; letter-spacing: 0; }
}

/* ---------- Busca recolhível (um componente, todas as telas HubMed; comum.js › buscaRecolhivel) ----------
 * Em barra larga o campo fica visível, com largura do conteúdo. Em barra estreita (menos de 600 px, medidos
 * pela própria barra e não pela janela) some e fica só a lupa; a lupa abre o campo já focado. */
.hm-barra { container: hm-barra / inline-size; }
.hm-busca-caixa { display: flex; align-items: center; flex: 0 1 240px; min-width: 0; max-width: 320px; }
.hm-busca-caixa .hm-busca { flex: 1 1 auto; min-width: 0; }
.hm-busca-lupa {
  display: none; width: 36px; height: 36px; flex: none; place-items: center; padding: 0;
  border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: #52525b; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
.hm-busca-lupa:hover { background: #f4f4f5; color: #18181b; }
.hm-busca-lupa:focus-visible { outline: 2px solid #3f51b5; outline-offset: 2px; }
@container hm-barra (max-width: 600px) {
  /* Recolhida, a lupa fica junto de Atualizar, à direita (sem vão vazio no meio da barra). */
  .hm-busca-caixa { flex: 0 0 auto; max-width: none; margin-left: auto; }
  [data-visual="hubmed"] .hm-barra > .hm-barra-acoes { margin-left: 0; }
  .hm-busca-lupa { display: inline-grid; }
  .hm-busca-caixa:not(.is-aberta):not(.tem-valor) .hm-busca { display: none; }
  .hm-busca-caixa:is(.is-aberta, .tem-valor) .hm-busca-lupa { display: none; }
  .hm-busca-caixa:is(.is-aberta, .tem-valor) { flex: 1 1 240px; max-width: 340px; }
}
@media (max-width: 767px) {
  .hm-busca-caixa:is(.is-aberta, .tem-valor) { flex: 1 1 100%; max-width: none; }
}

/* Balão com o texto completo (comum.js › ligarBalao). Fica fora da tabela, que corta o que passa da largura. */
.hm-balao {
  position: fixed; z-index: 90; max-width: min(320px, calc(100vw - 16px)); padding: 7px 10px;
  border-radius: 8px; background: #18181b; color: #fff; font: 500 12px/1.4 var(--font);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, .2); pointer-events: none; white-space: normal; overflow-wrap: anywhere;
}
.hm-balao[hidden] { display: none; }

/* Celular: as ações do topo dividem a linha (sem um botão sozinho no canto) e os selects da barra não se esticam
 * até 100%: ficam com a largura do conteúdo. */
@media (max-width: 767px) {
  [data-visual="hubmed"] .hm-tela-topo > .hm-acoes { width: 100%; }
  [data-visual="hubmed"] .hm-tela-topo > .hm-acoes > .hm-hbtn { flex: 1 1 auto; justify-content: center; }
  [data-visual="hubmed"] .hm-barra > .hm-campo { flex: 0 1 170px; }
  /* Guias: Lista e Calendário, quando quebram a linha, viram um controle de largura total (não um par solto). */
}

/* Guias (HubMed): motivo do cancelamento em uma linha, com reticências; o texto completo fica no balão. */
:root[data-visual="hubmed"] .hm-guias-tabela .op-motivo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; cursor: help; }
:root[data-visual="hubmed"] .hm-guias-tabela .op-motivo:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
:root[data-visual="hubmed"] .hm-guias-tabela td[data-label="Situação"] > div { max-width: 170px; }
/* Linhas mais baixas: a altura vem do conteúdo, sem o mínimo de 42 px da tabela da casca. */
:root[data-visual="hubmed"] .hm-guias-tabela .op-table td { height: auto; padding-top: 5px; padding-bottom: 5px; line-height: 1.3; }
/* Ações da guia (lote B): visíveis sempre. Em repouso 70% (antes 45%, que sumia); 100% no hover, foco ou toque.
 * Ícones em cinza-escuro e o cancelar só fica vermelho no hover. */
:root[data-visual="hubmed"] .hm-guias-tabela .op-acoes { opacity: .7; }
:root[data-visual="hubmed"] .hm-guias-tabela tr:is(:hover, :focus-within) .op-acoes { opacity: 1; }
@media (hover: none) { :root[data-visual="hubmed"] .hm-guias-tabela .op-acoes { opacity: 1; } }
:root[data-visual="hubmed"] .hm-guias-tabela .op-acoes .btn { color: #3f3f46; }
:root[data-visual="hubmed"] .hm-guias-tabela .op-acoes .btn:hover:not(:disabled) { background: #f4f4f5; color: #18181b; }
:root[data-visual="hubmed"] .hm-guias-tabela .op-acoes .op-perigo:hover:not(:disabled) { background: #fef2f2; color: #dc2626; }
/* Status (antes Pagamento): o ícone do estado só aparece na tabela estreita (diagramacao.css); o texto fica para leitor de tela. */
:root[data-visual="hubmed"] .hm-guias-tabela .hm-st-ico { display: none; }

/* ---- Ajustes das anotações (painéis, filtros, barra de ações, cartões compactos, Configurações) ---- */
/* Dashboard: o painel de Atendimentos e a Fila não encostam na grade de cima. */
[data-visual="hubmed"] .hm-dash-grade { margin-bottom: 10px; }

/* Atualizar e Excel no canto da barra de filtros, só com ícone e em uma linha. */
[data-visual="hubmed"] .hm-barra-acoes { display: flex; gap: 6px; margin-left: auto; align-items: center; flex-wrap: nowrap; }
[data-visual="hubmed"] .hm-barra-acoes .hm-hbtn { width: 36px; height: 36px; padding: 0; justify-content: center; }
[data-visual="hubmed"] .hm-barra-acoes .hm-hbtn span { display: none; }

/* Filtros de situação: o que não cabe é cortado com reticências; sem espaço, vira só ícone. */
[data-visual="hubmed"] .op-sit button { overflow: hidden; text-overflow: ellipsis; }
.op-sit-ico { display: inline-flex; flex: none; }

/* Cards de guia: cabem duas colunas mesmo em tela estreita. */
[data-visual="hubmed"] .op-cards { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

/* Caixa: cada lançamento ocupa no máximo duas linhas no cartão. */
@container hm-tabela (max-width: 720px) {
  [data-visual="hubmed"] .hm-caixa-lista .hm-tabela tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto auto; gap: 2px 10px; align-items: center; padding: 8px 10px; }
  [data-visual="hubmed"] .hm-caixa-lista .hm-tabela td { display: block; width: auto; padding: 0; min-height: 0; height: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
  [data-visual="hubmed"] .hm-caixa-lista .hm-tabela td::before { display: none; }
  [data-visual="hubmed"] .hm-caixa-lista .hm-tabela td:nth-child(1) { grid-column: 1; grid-row: 1; }
  [data-visual="hubmed"] .hm-caixa-lista .hm-tabela td:nth-child(4) { grid-column: 2 / span 4; grid-row: 1; font-weight: 700; }
  [data-visual="hubmed"] .hm-caixa-lista .hm-tabela td:nth-child(8) { grid-column: 6; grid-row: 1; justify-self: end; }
  [data-visual="hubmed"] .hm-caixa-lista .hm-tabela td:nth-child(2) { grid-column: 1; grid-row: 2; }
  [data-visual="hubmed"] .hm-caixa-lista .hm-tabela td:nth-child(3) { grid-column: 2; grid-row: 2; }
  [data-visual="hubmed"] .hm-caixa-lista .hm-tabela td:nth-child(5) { grid-column: 3; grid-row: 2; }
  [data-visual="hubmed"] .hm-caixa-lista .hm-tabela td:nth-child(6) { grid-column: 4; grid-row: 2; }
  [data-visual="hubmed"] .hm-caixa-lista .hm-tabela td:nth-child(7) { grid-column: 5; grid-row: 2; }
  [data-visual="hubmed"] .hm-caixa-lista .hm-tabela td:nth-child(9) { grid-column: 6; grid-row: 2; justify-self: end; }
  [data-visual="hubmed"] .hm-caixa-lista .hm-tabela td:nth-child(9) { grid-column: 6; grid-row: 2; justify-self: end; }
}
@container hm-tabela (max-width: 480px) {
  [data-visual="hubmed"] .hm-caixa-lista .hm-tabela td:nth-child(6) { display: none; }
  [data-visual="hubmed"] .hm-caixa-lista .hm-tabela td:nth-child(5) { display: none; }
}


/* Visualizador da guia (Orçamentos › Ver guia). */
.vg-pdf { width: 100%; height: 68vh; border: 0; border-radius: 8px; background: var(--surface-soft); }
.vg-vazio { display: flex; flex-direction: column; gap: 6px; padding: 24px 8px; text-align: center; }

/* Configurações: campos com largura padrão (a grade de campos relacionados está em configuracoes.css). */
.cfg-form .input { max-width: 320px; }

/* ---- Rodada 3: telas estreitas e janelas divididas (medido pelo espaço da própria tela, não pela janela) ---- */
[data-visual="hubmed"] .main { container: hm-corpo / inline-size; }  /* área de todas as telas HubMed, incluindo o dashboard */

/* Respiro entre indicadores e o bloco de baixo (grade do dashboard, tabela de guias canceladas). */
[data-visual="hubmed"] .hm-kpis { margin-bottom: 12px; }

/* Barra de filtros: uma linha só, no PC e no celular. Com a tela menor, tudo encolhe. */
[data-visual="hubmed"] .hm-barra { flex-wrap: nowrap; align-items: center; }
[data-visual="hubmed"] .hm-barra > * { min-width: 0; }
[data-visual="hubmed"] .hm-barra .seg { min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
[data-visual="hubmed"] .hm-barra .seg::-webkit-scrollbar { display: none; }
@container hm-corpo (max-width: 900px) {
  [data-visual="hubmed"] .hm-barra { gap: 6px; padding: 8px; }
  [data-visual="hubmed"] .hm-barra .seg button { font-size: 11px; padding: 4px 6px; }
  [data-visual="hubmed"] .hm-barra .hm-barra-acoes { gap: 4px; }
  [data-visual="hubmed"] .hm-barra .hm-barra-acoes .hm-hbtn { width: 32px; height: 32px; }
}
@container hm-corpo (max-width: 600px) {
  [data-visual="hubmed"] .hm-barra .seg button { font-size: 10.5px; padding: 4px 5px; }
  [data-visual="hubmed"] .hm-barra .hm-busca-caixa { flex: 0 0 auto; }
  [data-visual="hubmed"] .hm-dash-periodo { flex-wrap: nowrap; align-items: center; gap: 6px; padding: 8px; }
  [data-visual="hubmed"] .hm-dash-periodo > .small { display: none; }
  [data-visual="hubmed"] .hm-dash-periodo .seg button { font-size: 10.5px; padding: 4px 5px; }
  [data-visual="hubmed"] .hm-dash-periodo > .btn span { display: none; }
}

/* Indicadores em telas estreitas: três por linha, cada um só com o que cabe. */
@container hm-corpo (max-width: 560px) {
  [data-visual="hubmed"] .hm-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  [data-visual="hubmed"] .hm-kpi { padding: 6px 8px; border-radius: 9px; min-width: 0; }
  [data-visual="hubmed"] .hm-kpi-ico { display: none; }
  [data-visual="hubmed"] .hm-kpi-rot,
  [data-visual="hubmed"] .hm-kpi-sub { font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  [data-visual="hubmed"] .hm-kpi-valor { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* Tabelas em cartão (guias canceladas, afiliados…): o nome numa linha; os demais campos seguem em linha, só com
 * o rótulo curto; a ação fica à direita. Cartão com duas ou três linhas, no lugar de um campo por linha. */
@container hm-tabela (max-width: 720px) {
  [data-visual="hubmed"] :where(.hm-tabela-cartao:not(.hm-relatorio)):not(.hm-caixa-lista):not(.hm-pacientes-tabela) .hm-tabela tr { display: flow-root; padding: 8px 10px; }
  [data-visual="hubmed"] :where(.hm-tabela-cartao:not(.hm-relatorio)):not(.hm-caixa-lista):not(.hm-pacientes-tabela) .hm-tabela td {
    display: inline-block; vertical-align: top; width: auto; min-width: 0; min-height: 0; height: auto; padding: 0;
    margin: 0 14px 4px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  }
  [data-visual="hubmed"] :where(.hm-tabela-cartao:not(.hm-relatorio)):not(.hm-caixa-lista):not(.hm-pacientes-tabela) .hm-tabela td > .hm-celula { display: inline; }
  [data-visual="hubmed"] :where(.hm-tabela-cartao:not(.hm-relatorio)):not(.hm-caixa-lista):not(.hm-pacientes-tabela) .hm-tabela td::before { font-size: 9px; margin-right: 4px; }
  [data-visual="hubmed"] :where(.hm-tabela-cartao:not(.hm-relatorio)):not(.hm-caixa-lista):not(.hm-pacientes-tabela) .hm-tabela td:first-child { display: block; margin-right: 0; white-space: normal; }
  [data-visual="hubmed"] :where(.hm-tabela-cartao:not(.hm-relatorio)):not(.hm-caixa-lista):not(.hm-pacientes-tabela) .hm-tabela td:first-child > .hm-celula { display: block; }
  [data-visual="hubmed"] :where(.hm-tabela-cartao:not(.hm-relatorio)):not(.hm-caixa-lista):not(.hm-pacientes-tabela) .hm-tabela td:first-child::before,
  [data-visual="hubmed"] :where(.hm-tabela-cartao:not(.hm-relatorio)):not(.hm-caixa-lista):not(.hm-pacientes-tabela) .hm-tabela td:last-child::before { display: none; }
  [data-visual="hubmed"] :where(.hm-tabela-cartao:not(.hm-relatorio)):not(.hm-caixa-lista):not(.hm-pacientes-tabela) .hm-tabela td:last-child { float: right; margin: 0 0 4px 8px; }
}

/* Pacientes: nome e olho na primeira linha; contato (só o cadastrado) e lápis na segunda. */
[data-visual="hubmed"] .hm-row-action { width: 28px; height: 28px; border-radius: 9px; }
[data-visual="hubmed"] .hm-pacientes-tabela .hm-pac-nome { font-size: 14px; font-weight: 700; color: #18181b; }
[data-visual="hubmed"] .hm-pacientes-tabela .hm-pac-dados { font-size: 12px; color: #52525b; }
[data-visual="hubmed"] .hm-pacientes-tabela .hm-pac-linha--oculto .hm-pac-nome { color: #71717a; font-weight: 600; text-decoration: line-through; }
[data-visual="hubmed"] .hm-pacientes-tabela .hm-pac-ocultos { white-space: nowrap; }
/* Ficha do paciente (modal), formulário de cadastro a partir do HubMed. */
[data-visual="hubmed"] .hm-pac-ficha { display: grid; gap: 12px; }
[data-visual="hubmed"] .hm-pac-dados { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 16px; margin: 0; }
[data-visual="hubmed"] .hm-pac-dados > div { min-width: 0; }
[data-visual="hubmed"] .hm-pac-dados dt { font-size: 12px; font-weight: 600; color: #64748b; }
[data-visual="hubmed"] .hm-pac-dados dd { margin: 2px 0 0; font-size: 14px; color: #18181b; overflow-wrap: anywhere; }
[data-visual="hubmed"] .hm-pac-bloco { display: grid; gap: 6px; padding-top: 10px; border-top: 1px solid #e4e4e7; }
[data-visual="hubmed"] .hm-pac-bloco h3 { margin: 0; font-size: 13px; font-weight: 800; color: #1f2a5b; }
[data-visual="hubmed"] .hm-pac-bloco p, [data-visual="hubmed"] .hm-pac-dica { margin: 0; font-size: 13px; color: #52525b; }
[data-visual="hubmed"] .hm-pac-acoes { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
[data-visual="hubmed"] .hm-pac-acoes .btn { white-space: nowrap; }
[data-visual="hubmed"] .hm-pac-form { display: grid; gap: 10px; }
[data-visual="hubmed"] .hm-pac-erro { margin: 0; font-size: 13px; color: #dc2626; }
[data-visual="hubmed"] .hm-pac-erro:empty { display: none; }
@container hm-tabela (max-width: 720px) {
  [data-visual="hubmed"] .hm-pacientes-tabela .hm-tabela tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; padding: 8px 10px; }
  [data-visual="hubmed"] .hm-pacientes-tabela .hm-tabela td { display: block; width: auto; min-width: 0; height: auto; min-height: 0; padding: 0; border: 0; white-space: normal; }
  [data-visual="hubmed"] .hm-pacientes-tabela .hm-tabela td::before { display: none; }
  [data-visual="hubmed"] .hm-pacientes-tabela .hm-tabela td:nth-child(1) { grid-column: 1; grid-row: 1; }
  [data-visual="hubmed"] .hm-pacientes-tabela .hm-tabela td:nth-child(2) { grid-column: 1; grid-row: 2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  [data-visual="hubmed"] .hm-pacientes-tabela .hm-tabela td:nth-child(3) { grid-column: 2; grid-row: 1; }
  [data-visual="hubmed"] .hm-pacientes-tabela .hm-tabela td:nth-child(4) { grid-column: 2; grid-row: 2; }
}

/* Caixa em tela estreita: as cinco formas de pagamento numa linha só; os três totais abaixo. */
@container hm-corpo (max-width: 560px) {
  [data-visual="hubmed"] .hm-caixa-totais > .hm-kpis:first-child { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  [data-visual="hubmed"] .hm-caixa-totais > .hm-kpis:first-child { gap: 3px; }
  [data-visual="hubmed"] .hm-caixa-totais > .hm-kpis:first-child .hm-kpi { padding: 5px 4px; border-radius: 8px; }
  [data-visual="hubmed"] .hm-caixa-totais > .hm-kpis:first-child .hm-kpi-rot { font-size: 8px; letter-spacing: 0; }
  [data-visual="hubmed"] .hm-caixa-totais > .hm-kpis:first-child .hm-kpi-valor { font-size: 9.5px; letter-spacing: -.3px; }
}

/* Orçamentos em tela estreita: indicadores em três colunas, calendário e cartões em largura total, período e
 * visão na mesma linha, e a atualização em texto miúdo. */
@container hm-corpo (max-width: 560px) {
  [data-visual="hubmed"] .op-resumo { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 8px 10px 0; }
  [data-visual="hubmed"] .op-resumo .kpi { padding: 6px 8px; min-width: 0; }
  [data-visual="hubmed"] .op-resumo .kpi-num { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  [data-visual="hubmed"] .op-cal-split { grid-template-columns: minmax(0, 1fr); }
  [data-visual="hubmed"] .op-cal-grade, [data-visual="hubmed"] .op-cal-semana { gap: 2px; }
  [data-visual="hubmed"] .op-cal-dia { min-height: 30px; }
  [data-visual="hubmed"] .op-cards { grid-template-columns: minmax(0, 1fr); }
  [data-visual="hubmed"] .op-barra { gap: 6px; padding: 8px; }
  [data-visual="hubmed"] .op-barra .op-periodo-host .seg button { font-size: 10.5px; padding: 3px 4px; }
  [data-visual="hubmed"] .op-barra .op-vistas { flex: none; }
  [data-visual="hubmed"] .op-barra .op-vistas button { padding: 3px 6px; }
  [data-visual="hubmed"] .op-frescor-slot { font-size: 10px; }
}

/* Telas com ações no topo e filtros segmentados em tela estreita: ações só com ícone, um só nível de linha. */
@container hm-corpo (max-width: 560px) {
  [data-visual="hubmed"] .hm-tela-topo .hm-hbtn { padding: 0 10px; }
  [data-visual="hubmed"] .hm-tela-topo .hm-hbtn span { display: none; }
  [data-visual="hubmed"] .hm-tela-topo .hm-hbtn--add span { display: inline; }
  [data-visual="hubmed"] .hm-barra .seg { flex-wrap: nowrap; }
  [data-visual="hubmed"] .hm-barra .seg button { white-space: nowrap; }
}

/* Célula sem valor não mostra o rótulo sozinho (ex.: "SITUAÇÃO" sem selo). */
@container hm-tabela (max-width: 720px) {
  [data-visual="hubmed"] :where(.hm-tabela-cartao:not(.hm-relatorio)) .hm-tabela td:empty { display: none; }
}

/* ---- Rodada 4 · Catálogo (Exames e Prestadores) ----
 * Celular: abas, contador discreto e "+" na mesma linha, com alvos de 40 px; o "+" fica só com ícone (título e nome para leitor).
 * Cartões: linhas rotuladas (Prestador, Preço do paciente, Repasse, Lucro, Situação), sem texto cortado à direita. */
:root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-segmento button { min-height: 40px; }
:root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo .hm-pilula { white-space: nowrap; }
@container hm-corpo (max-width: 600px) {
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo { flex-wrap: nowrap; gap: 6px; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-segmento { flex: 1 1 auto; min-width: 0; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-segmento button { flex: 1 1 0; min-width: 0; padding: 0 8px; font-size: 12px; white-space: nowrap; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > [data-contagem] { flex: none; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo .hm-pilula { font-size: 9px; padding: 3px 7px; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-acoes { flex: none; margin-left: 0; width: auto; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo .hm-hbtn--add { width: 40px; height: 40px; padding: 0; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo .hm-hbtn--add span { display: none; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-barra .hm-funil,
  :root[data-visual="hubmed"] .hm-catalogo .hm-barra-acoes .hm-hbtn { width: 40px; height: 40px; }
}
@container hm-tabela (max-width: 720px) {
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 12px; align-items: start; padding: 10px 12px;
  }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela td {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    width: auto; min-width: 0; height: auto; min-height: 0; padding: 0; margin: 0; float: none; max-width: none;
    white-space: normal; overflow: visible; text-overflow: clip;
  }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela td > .hm-celula { display: block; min-width: 0; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela td::before {
    display: block; content: attr(data-rotulo); font: 600 11px var(--font); letter-spacing: 0; text-transform: none; color: #71717a;
  }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela td:first-child::before,
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela td:last-child::before { display: none; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela td:has(> .hm-celula:empty) { display: none; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela td:nth-child(1),
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela td:nth-child(2) { grid-column: 1 / -1; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela td:nth-child(3),
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela td:nth-child(5) { grid-column: 1; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela td:nth-child(4),
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela td:nth-child(6) { grid-column: 2; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela td:last-child {
    grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; align-items: center; margin-top: 2px;
  }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela td:last-child > .hm-celula { display: flex; justify-content: flex-end; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-row-action { width: 40px; height: 40px; }
}


/* ---- Pacientes (HubMed): nome com nascimento na mesma linha; contato com reticências (texto completo no title);
 * respiro antes do rodapé da lista. ---- */
[data-visual="hubmed"] .hm-pac-linha { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
[data-visual="hubmed"] .hm-pac-linha .hm-pac-nome { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-visual="hubmed"] .hm-pac-nasc { flex: none; font-size: 11px; color: #52525b; white-space: nowrap; }
[data-visual="hubmed"] .hm-pac-so-crm { flex: none; align-self: center; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: #eef2ff; color: #3730a3; white-space: nowrap; }
[data-visual="hubmed"] .hm-pac-dados { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-visual="hubmed"] .hm-pacientes-tabela .hm-tabela td > .hm-celula { min-width: 0; }
.hm-pac-rodape { margin-top: 10px; padding-top: 10px; }

/* ---- Rodada 4 · Relatórios, Caixa e Dashboard (HubMed) ---- */
/* Caixa: a data fica numa linha só (sem "03/11," quebrado sobre "08:26"). */
@container hm-tabela (max-width: 720px) {
  :root[data-visual="hubmed"] .hm-caixa-lista .hm-tabela tbody td:nth-child(7) { white-space: nowrap; }
}
/* Caixa no celular: os três totais voltam a ser legíveis (a regra de cinco colunas de antes encolhia o texto). */
@container hm-corpo (max-width: 560px) {
  [data-visual="hubmed"] .hm-caixa-totais > .hm-kpis:first-child { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  [data-visual="hubmed"] .hm-caixa-totais > .hm-kpis:first-child .hm-kpi { padding: 6px 8px; }
  [data-visual="hubmed"] .hm-caixa-totais > .hm-kpis:first-child .hm-kpi-rot { font-size: 9px; letter-spacing: .2px; }
  [data-visual="hubmed"] .hm-caixa-totais > .hm-kpis:first-child .hm-kpi-valor { font-size: 14px; letter-spacing: -.2px; }
}
/* Dashboard: nome de grupo ou exame longo quebra em duas linhas, em vez de cortar com reticências. */
[data-visual="hubmed"] .hm-dash-barras li > div > span { white-space: normal; overflow-wrap: anywhere; }

/* ---------- Alvos de toque ≥ 40 px nas telas HubMed (rodada 5, alvos-hubmed) ----------
 * A área extra vem de ::after absoluto com inset negativo: o desenho e o layout não mudam.
 * Onde dois alvos ficam lado a lado, o vão entre eles (gap) limita a expansão, para não se sobreporem. */
[data-visual="hubmed"] :is(.hm-row-action, .hm-pg, .hm-hbtn, .hm-busca-lupa, .res-seg button, .hm-segmento button,
  .op-sit button, .op-vistas button, .hm-dash-periodo .btn, .hm-dash-exportar, .op-funil, .op-frescor .btn,
  .hm-equipe-ordem button) { position: relative; }
[data-visual="hubmed"] :is(.hm-row-action, .hm-pg, .hm-hbtn, .hm-busca-lupa, .res-seg button, .hm-segmento button,
  .op-sit button, .op-vistas button, .hm-dash-periodo .btn, .hm-dash-exportar, .op-funil, .op-frescor .btn,
  .hm-equipe-ordem button)::after { content: ""; position: absolute; }
/* Ações de linha (28 px com borda de 1 px): a área de dentro da borda é 26; 26 + 2×7 = 40. Por isso o vão entre elas sobe para 12 px nas telas de lista. */
[data-visual="hubmed"] :is(.hm-pacientes-tabela, .hm-procedimentos, .hm-catalogo) .hm-row-action::after { inset: -7px; }
[data-visual="hubmed"] :is(.hm-pacientes-tabela, .hm-procedimentos, .hm-catalogo) .hm-acoes-linha { gap: 12px; }
/* Paginação (34 px): 34 + 2×3 = 40; vão de 6 px entre os números. */
[data-visual="hubmed"] .hm-pg::after { inset: -3px; }
[data-visual="hubmed"] .hm-paginas { gap: 6px; }
/* Botões de barra (com borda de 1 px): ::after cobre a área interna; a expansão leva a caixa a 40 px. */
[data-visual="hubmed"] .hm-hbtn::after { inset: -2px -3px; }
[data-visual="hubmed"] :is(.hm-hbtn--refresh, .hm-hbtn--excel, .hm-hbtn--discreto, .op-hbtn-contorno)::after { inset: -2px -5px; }
[data-visual="hubmed"] .hm-busca-lupa::after { inset: -3px; }
/* Período (30 px de altura, 36 de largura no personalizado) e segmentos de 26 px. */
[data-visual="hubmed"] .res-seg button::after { inset: -5px 0; }
[data-visual="hubmed"] .res-seg .res-seg-cal::after { inset: -5px -4px -5px 0; }
[data-visual="hubmed"] .hm-segmento button::after { inset: -7px 0; }
[data-visual="hubmed"] .hm-guias .res-seg button::after { inset: -9px 0; }
[data-visual="hubmed"] .hm-guias .op-sit button::after { inset: -11px 0; }
[data-visual="hubmed"] :is(.op-funil, .hm-dash-periodo .btn, .hm-dash-exportar, .op-frescor .btn)::after { inset: -6px; }
[data-visual="hubmed"] .hm-equipe-ordem button::after { inset: -5px 0; }
/* Botões de barra no celular: o vão entre eles sobe para 10 px, para as áreas de 40 px não se sobreporem. */
@media (max-width: 767px) {
  [data-visual="hubmed"] .hm-barra .hm-barra-acoes { gap: 10px; }
}
/* Campo de busca em Pacientes: mesma altura dos controles da barra (32 px, sistema-alvo da S9). */
:root[data-visual="hubmed"] .hm-busca-caixa .hm-input { height: var(--ctl); }
/* Dias do calendário de guias: 30 px de altura viram 40 no celular (linhas ficam mais legíveis). */
@media (max-width: 767px) {
  [data-visual="hubmed"] .hm-guias .op-cal-dia { min-height: 40px; }
}

/* ---- Rodada 6 (densidade-hubmed): cartões de Procedimentos e Catálogo (exames) na faixa estreita ----
 * Procedimentos (lote D2: sem a coluna Prestadores): nome na primeira linha; categoria à esquerda e ações à direita, na segunda.
 * Catálogo: preço do paciente, repasse e lucro numa faixa de 3 colunas (rótulo pequeno em cima, valor embaixo). */
@container hm-tabela (max-width: 720px) {
  :root[data-visual="hubmed"] .hm-procedimentos .hm-tabela-cartao .hm-tabela tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto;
    column-gap: 8px; row-gap: 4px; align-items: center; padding: 8px 10px;
  }
  :root[data-visual="hubmed"] .hm-procedimentos .hm-tabela-cartao .hm-tabela td { display: block; margin: 0; float: none; max-width: none; width: auto; }
  :root[data-visual="hubmed"] .hm-procedimentos .hm-tabela-cartao .hm-tabela td:nth-child(1) { grid-column: 1 / -1; grid-row: 1; }
  :root[data-visual="hubmed"] .hm-procedimentos .hm-tabela-cartao .hm-tabela td:nth-child(2) { grid-column: 1; grid-row: 2; justify-self: start; }
  :root[data-visual="hubmed"] .hm-procedimentos .hm-tabela-cartao .hm-tabela td:nth-child(3) { grid-column: 2; grid-row: 2; justify-self: end; align-self: center; }

  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="Preço do paciente"]) {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 8px; row-gap: 6px;
    align-items: center; padding: 8px 10px;
  }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="Preço do paciente"]) td {
    display: block; margin: 0; float: none; text-align: left;
  }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="Preço do paciente"]) td:nth-child(1) { grid-column: 1 / -1; grid-row: 1; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="Preço do paciente"]) td:nth-child(2) { grid-column: 1 / span 2; grid-row: 2; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="Preço do paciente"]) td:nth-child(6) { grid-column: 3; grid-row: 2; justify-self: end; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="Preço do paciente"]) td:nth-child(3) { grid-column: 1; grid-row: 3; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="Preço do paciente"]) td:nth-child(4) { grid-column: 2; grid-row: 3; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="Preço do paciente"]) td:nth-child(5) { grid-column: 3; grid-row: 3; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="Preço do paciente"]) td:nth-child(7) { grid-column: 1 / -1; grid-row: 4; justify-self: end; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="Preço do paciente"]) td:nth-child(3)::before,
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="Preço do paciente"]) td:nth-child(4)::before,
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="Preço do paciente"]) td:nth-child(5)::before { display: block; margin: 0; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="Preço do paciente"]) td:is(:nth-child(3), :nth-child(4), :nth-child(5)) > .hm-celula { display: block; }
}

/* Relatórios: Excel, PDF e Atualizar ficam na linha do período, só com ícone. No celular a barra tem duas linhas: período + ações; abas na de baixo. */
[data-visual="hubmed"] .hm-rel-filtros .hm-barra-acoes { gap: 4px; }
[data-visual="hubmed"] .hm-rel-filtros .hm-barra-acoes .hm-hbtn { width: 32px; height: 32px; }
/* Encolher para 32 px é só no desenho: a área de toque destes botões continua em 40 px (rodada 5). */
[data-visual="hubmed"] .hm-rel-filtros .hm-barra-acoes .hm-hbtn::after { inset: -4px; }
@container hm-corpo (max-width: 900px) {
  [data-visual="hubmed"] .hm-rel-filtros .op-periodo-host .seg button { padding: 3px 4px; }
  [data-visual="hubmed"] .hm-rel-filtros .hm-barra-acoes { order: 0; }
}

/* ---- Rodada 7 · Catálogo (HubMed): cartões compactos, ações na faixa dos dados ----
 * Exame: nome e situação na 1ª faixa; prestador e ações na 2ª (ações à direita, sem vazio à esquerda);
 * preço do paciente, repasse e lucro na 3ª. Cartão sem a faixa de ações sozinha embaixo.
 * Prestador: nome; CNPJ e filial; faturamento e exames; situação e ações na última faixa. */
@container hm-tabela (max-width: 720px) {
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="Preço do paciente"]) td:nth-child(1) { grid-column: 1 / span 2; grid-row: 1; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="Preço do paciente"]) td:nth-child(6) { grid-column: 3; grid-row: 1; justify-self: end; align-self: start; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="Preço do paciente"]) td:nth-child(2) { grid-column: 1 / span 2; grid-row: 2; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="Preço do paciente"]) td:nth-child(7) { grid-column: 3; grid-row: 2; justify-self: end; align-self: center; margin-top: 0; }

  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="CNPJ"]) {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; row-gap: 6px;
    align-items: center; padding: 8px 10px;
  }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="CNPJ"]) td {
    display: block; margin: 0; float: none; text-align: left; min-width: 0;
  }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="CNPJ"]) td:nth-child(1) { grid-column: 1 / -1; grid-row: 1; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="CNPJ"]) td:nth-child(2) { grid-column: 1; grid-row: 2; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="CNPJ"]) td:nth-child(3) { grid-column: 2; grid-row: 2; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="CNPJ"]) td:nth-child(4) { grid-column: 1; grid-row: 3; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="CNPJ"]) td:nth-child(5) { grid-column: 2; grid-row: 3; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="CNPJ"]) td:nth-child(6) { grid-column: 1; grid-row: 4; justify-self: start; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela tr:has(> td[data-rotulo="CNPJ"]) td:nth-child(7) { grid-column: 2; grid-row: 4; justify-self: end; align-self: center; margin-top: 0; }
}

/* Estados e foco das telas de leitura do HubMed (rodada 8, estados-hubmed): ação dentro do vazio e do erro; foco visível de 2px. */
.hm-vazio-acao { margin-top: 10px; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
[data-visual="hubmed"] :is(.hm-dashboard, .hm-guias, .hm-procedimentos, .hm-tela[data-tela="caixa"], .hm-tela[data-tela="pacientes"], .hm-tela[data-tela="relatorios"], .hm-tela[data-tela="catalogo"]) :is(button, a, select, input):focus-visible { outline: 2px solid #3f51b5; outline-offset: 2px; }

/* ---- Rodada 9: Mensagens e Logs (HubMed). Barra em 2 linhas no celular e 1 no tablet/desktop; Atualizar dentro da tela. ---- */
/* Mensagens: os quatro filtros de situação cabem numa linha com a lupa e Atualizar; KPIs em uma fileira no tablet. */
@media (min-width: 768px) {
  :root[data-visual="hubmed"] .hm-tela-mensagens .hm-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  /* Quatro numa fileira: o rótulo quebra em duas linhas em vez de cortar com reticências. */
  :root[data-visual="hubmed"] .hm-tela-mensagens .hm-kpi-rot { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.2; }
}
@media (max-width: 767px) {
  [data-visual="hubmed"] .hm-tela-mensagens .hm-barra { padding: 8px; gap: 6px; }
  [data-visual="hubmed"] .hm-tela-mensagens .hm-barra > .hm-segmento { flex: 1 1 0; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  [data-visual="hubmed"] .hm-tela-mensagens .hm-barra > .hm-segmento::-webkit-scrollbar { display: none; }
  [data-visual="hubmed"] .hm-tela-mensagens .hm-barra > .hm-segmento button { flex: none; padding: 4px 6px; font-size: 10.5px; white-space: nowrap; }
  [data-visual="hubmed"] .hm-tela-mensagens .hm-tela-corpo { gap: 6px; }
}

/* Logs: período numa linha cheia; lupa, usuário e Atualizar na segunda linha, à direita. */
@media (max-width: 767px) {
  [data-visual="hubmed"] .hm-tela-logs .hm-barra { flex-wrap: wrap; padding: 8px; gap: 6px; }
  [data-visual="hubmed"] .hm-tela-logs .hm-barra > .op-periodo-host { order: 0; flex: 1 1 100%; min-width: 0; }
  [data-visual="hubmed"] .hm-tela-logs .hm-barra > .op-periodo-host .res-seg { display: flex; width: 100%; }
  [data-visual="hubmed"] .hm-tela-logs .hm-barra > .op-periodo-host .res-seg button { flex: 1 1 0; min-width: 0; padding: 4px 4px; font-size: 11px; }
  [data-visual="hubmed"] .hm-tela-logs .hm-barra > .hm-busca-caixa { order: 1; }
  [data-visual="hubmed"] .hm-tela-logs .hm-barra > .hm-campo { order: 1; flex: 1 1 0; min-width: 0; }
  [data-visual="hubmed"] .hm-tela-logs .hm-barra > .hm-barra-acoes { order: 1; }
  [data-visual="hubmed"] .hm-tela-logs .hm-tela-corpo { gap: 6px; }
}

/* ---- Rodada 9 (contas-guias): Contas a pagar, Guias canceladas e Gestão de guias, no celular de 390 px ---- */
/* Contas a pagar: Excel, Atualizar, Novo registro e Classificações ficam na linha dos filtros, à direita (ícone + tip).
 * Sem a linha de botões do topo, o conteúdo sobe. Campos encolhem antes de quebrar: no celular a barra usa 2 linhas. */
/* :root + atributo: a diagramação (hubmed-diagramacao.css) define a barra com a mesma especificidade e carrega depois. */
:root[data-visual="hubmed"] .hm-contas-pagar .hm-barra { flex-wrap: wrap; row-gap: 6px; gap: 4px; }
:root[data-visual="hubmed"] .hm-contas-pagar .hm-barra-acoes { margin-left: auto; }
@container hm-barra (max-width: 600px) {
  :root[data-visual="hubmed"] .hm-contas-pagar .hm-barra > .hm-campo { flex: 1 1 100px; width: auto; min-width: 0; }
  :root[data-visual="hubmed"] .hm-contas-pagar .hm-barra > .hm-campo:has(select) { flex: 0 0 104px; }
  :root[data-visual="hubmed"] .hm-contas-pagar .hm-barra .hm-input { padding: 0 6px; font-size: 12px; }
  :root[data-visual="hubmed"] .hm-contas-pagar .hm-barra select.hm-input { width: 100%; min-width: 0; }
  :root[data-visual="hubmed"] .hm-contas-pagar .hm-barra-acoes { gap: 3px; }
}
@media (max-width: 767px) {
  /* Mais específico que a regra de diagramação (auto-fit 150px), que venceria por ordem de carga.
   * Dois cartões na primeira fileira; "Em aberto" ocupa a largura toda, em uma faixa baixa (valor e legenda lado a lado). */
  :root[data-visual="hubmed"] .hm-contas-pagar .hm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  [data-visual="hubmed"] .hm-contas-pagar .hm-tela-corpo { gap: 6px; }
  [data-visual="hubmed"] .hm-contas-pagar .hm-kpi { padding: 5px 10px; gap: 2px; }
  :root[data-visual="hubmed"] .hm-contas-pagar .hm-kpis { row-gap: 4px; }
  :root[data-visual="hubmed"] .hm-contas-pagar .hm-barra { padding: 8px; }
  [data-visual="hubmed"] .hm-contas-pagar .hm-kpi-valor { font-size: 15px; }
  [data-visual="hubmed"] .hm-contas-pagar .hm-kpi:last-child { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 10px; row-gap: 2px; }
  [data-visual="hubmed"] .hm-contas-pagar .hm-kpi:last-child .hm-kpi-topo { width: 100%; }
  [data-visual="hubmed"] .hm-contas-pagar .hm-kpi-sub { font-size: 10px; }
}

/* Guias canceladas: uma linha só (lupa, período na faixa do calendário, Atualizar, PDF e Excel). Com a faixa
 * aberta, o período ocupa a linha de baixo (regra da faixa em hubmed-diagramacao.css, "Rodada L1"). */
[data-visual="hubmed"] .hm-guias-canceladas .hm-barra:not(.is-faixa-periodo):not(:has(:is(.res-seg-cal[aria-expanded="true"], .res-seg > button:not(.res-seg-cal):is(:focus, :active)))) { flex-wrap: nowrap; }
[data-visual="hubmed"] .hm-guias-canceladas .hm-barra-acoes { margin-left: auto; }

/* Gestão de guias: localizar pelo número com campo e Buscar lado a lado, centralizados, e cartão mais baixo. */
@media (max-width: 767px) {
  [data-visual="hubmed"] .hm-datas-guias .hm-guia-busca { padding: 12px; gap: 8px; }
  [data-visual="hubmed"] .hm-datas-guias .hm-guia-busca[hidden] { display: none; }
  :root[data-visual="hubmed"] .hm-datas-guias .hm-guia-busca { flex-wrap: nowrap; align-items: center; }
  :root[data-visual="hubmed"] .hm-datas-guias .hm-guia-busca .hm-busca { flex: 0 1 200px; max-width: 200px; }
  :root[data-visual="hubmed"] .hm-datas-guias .hm-guia-busca .hm-hbtn { flex: none; }
}

/* Procedimentos: Editar e Vincular à vista; o resto no ⋯ da linha. O menu abre logo abaixo do ⋯, dentro da própria célula. */
:root[data-visual="hubmed"] .hm-procedimentos .hm-tabela td:last-child { overflow: visible; } /* o balão do ⋯ não pode ser cortado pela célula */
:root[data-visual="hubmed"] .hm-procedimentos .hm-mais { position: relative; display: inline-flex; }
:root[data-visual="hubmed"] .hm-procedimentos .hm-mais-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; }
:root[data-visual="hubmed"] .hm-procedimentos .hm-mais-pop { display: none; }
:root[data-visual="hubmed"] .hm-procedimentos .hm-mais.is-aberto .hm-mais-pop { display: flex; flex-direction: column; gap: 2px; position: absolute; top: calc(100% + 4px); right: 0; z-index: 20; min-width: 230px; padding: 4px; background: #fff; border: 1px solid #e1e7ef; border-radius: 10px; box-shadow: 0 8px 24px rgba(15, 23, 42, .12); }
:root[data-visual="hubmed"] .hm-procedimentos .hm-mais-item { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: #1f2a5b; font: 500 13px var(--font); white-space: nowrap; cursor: pointer; }
:root[data-visual="hubmed"] .hm-procedimentos .hm-mais-item:hover:not(:disabled) { background: #f4f4f5; }
:root[data-visual="hubmed"] .hm-procedimentos .hm-mais-item:disabled { color: #a1a1aa; cursor: not-allowed; }

/* Procedimentos, barra estreita: o contador some (o rodapé já mostra o total) e os filtros abrem num balão sob a barra,
 * sem quebrar a linha. */
:root[data-visual="hubmed"] .hm-procedimentos .hm-barra { position: relative; }
@container hm-barra (max-width: 600px) {
  :root[data-visual="hubmed"] .hm-procedimentos .hm-barra [data-contagem] { display: none; }
  :root[data-visual="hubmed"] .hm-procedimentos .hm-barra.is-filtros-abertos .hm-campo[data-campo] { position: absolute; top: calc(100% + 6px); left: 12px; right: 12px; z-index: 30; flex: none; min-width: 0; padding: 8px; background: #fff; border: 1px solid #e1e7ef; border-radius: 12px; box-shadow: 0 8px 24px rgba(15, 23, 42, .12); }
  :root[data-visual="hubmed"] .hm-procedimentos .hm-barra.is-filtros-abertos .hm-campo[data-campo] select { width: 100%; max-width: none; min-width: 0; }
}

/* Coluna Guia de Orçamentos (HubMed): "—" quando não emitida; os botões da guia só aparecem no hover
 * ou no foco da linha. No toque (sem hover) ficam à vista. */
[data-visual="hubmed"] .hm-orc-guia-coluna .op-acoes { opacity: 0; transition: opacity var(--dur) var(--ease); }
[data-visual="hubmed"] tr.op-linha:hover .hm-orc-guia-coluna .op-acoes,
[data-visual="hubmed"] tr.op-linha:focus-within .hm-orc-guia-coluna .op-acoes { opacity: 1; }
@media (hover: none) { [data-visual="hubmed"] .hm-orc-guia-coluna .op-acoes { opacity: 1; } }

/* ---- Lote D2 (canário): Exames (catálogo) e Procedimentos ----
 * A tabela ocupa a largura do painel em qualquer janela, sem rolagem horizontal. Na faixa larga (acima de 720 px do
 * cartão), procedimento e prestador dividem o que sobra em proporção; preço, repasse, lucro, situação e ações ficam na
 * largura do conteúdo, e o cabeçalho pode quebrar em duas linhas. Procedimento e prestador: no máximo duas linhas,
 * depois reticências; o texto completo fica no title. Procedimentos: nome numa linha só, sem a coluna Prestadores.
 * Abaixo de 900 px do cartão a fonte vai a 11 px. A faixa estreita (cartões) segue as regras da Rodada 6 e 7. */
:root[data-visual="hubmed"] :is(.hm-catalogo, .hm-procedimentos) .hm-tabela-cartao .hm-tabela th { white-space: normal; }
@container hm-tabela (min-width: 721px) {
  :root[data-visual="hubmed"] :is(.hm-catalogo, .hm-procedimentos) .hm-tabela-cartao .hm-tabela { width: 100%; table-layout: auto; font-size: 12px; }
  :root[data-visual="hubmed"] :is(.hm-catalogo, .hm-procedimentos) .hm-tabela-cartao .hm-tabela td { white-space: nowrap; padding: 4px 8px; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela td[data-rotulo="Procedimento"] { width: 34%; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela td[data-rotulo="Prestador"]:has(> .hm-celula > .hm-clamp2) { width: 22%; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tabela-cartao .hm-tabela td[data-rotulo="Prestador"]:has(.hm-pessoa),
  :root[data-visual="hubmed"] .hm-procedimentos .hm-tabela-cartao .hm-tabela td[data-rotulo="Procedimento"] { max-width: 0; width: 100%; }
  :root[data-visual="hubmed"] :is(.hm-catalogo, .hm-procedimentos) .hm-tabela-cartao .hm-tabela td:is([data-rotulo="Categoria"], [data-rotulo="Preço do paciente"], [data-rotulo="Repasse"], [data-rotulo="Lucro"], [data-rotulo="Situação"], [data-rotulo="Ações"], [data-rotulo="CNPJ"], [data-rotulo="Filial"], [data-rotulo="Faturamento"], [data-rotulo="Exames"]) { width: 1%; }
  :root[data-visual="hubmed"] :is(.hm-catalogo, .hm-procedimentos) .hm-tabela-cartao .hm-tabela td[data-rotulo="Categoria"] > .hm-celula { max-width: 130px; }
}
@container hm-tabela (min-width: 721px) and (max-width: 900px) {
  :root[data-visual="hubmed"] :is(.hm-catalogo, .hm-procedimentos) .hm-tabela-cartao .hm-tabela { font-size: 11px; }
}
:root[data-visual="hubmed"] .hm-catalogo .hm-clamp2 {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  white-space: normal; overflow-wrap: anywhere; line-height: 1.3; max-width: 100%;
}
:root[data-visual="hubmed"] .hm-catalogo td[data-rotulo="Categoria"] > .hm-celula > span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root[data-visual="hubmed"] .hm-procedimentos .hm-tabela td .ellipsis { display: block; max-width: 100%; }
:root[data-visual="hubmed"] .hm-procedimentos td[data-rotulo="Categoria"] > .hm-celula > span { display: block; max-width: 100%; overflow: hidden; }
:root[data-visual="hubmed"] .hm-procedimentos .hm-selo { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Prestadores: nome e razão social, cada um numa linha com reticências (duas linhas no total). */
:root[data-visual="hubmed"] .hm-catalogo .hm-pessoa { min-width: 0; max-width: 100%; }
:root[data-visual="hubmed"] .hm-catalogo .hm-pessoa-texto { min-width: 0; max-width: 100%; }
:root[data-visual="hubmed"] .hm-catalogo .hm-pessoa-texto > b,
:root[data-visual="hubmed"] .hm-catalogo .hm-pessoa-texto > .hm-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Situação e ação de ativar/inativar: ícone em cor com contraste e sem esmaecer. A cor da ação vem da classe ac-* (base.css). */
:root[data-visual="hubmed"] .hm-catalogo .hm-sit-ok { display: inline-flex; color: #047857; }
:root[data-visual="hubmed"] :is(.hm-catalogo, .hm-procedimentos) .hm-tabela .hm-acoes-linha .hm-row-action { opacity: 1; }
@media (hover: none) { :root[data-visual="hubmed"] :is(.hm-catalogo, .hm-procedimentos) .hm-tabela .hm-acoes-linha .hm-row-action { opacity: 1; } }

/* Ações da linha ficam à vista, mas em segundo plano até a linha receber o ponteiro ou o foco:
   o olho lê primeiro o nome e o valor. No toque, seguem com contraste total. */
@media (hover: hover) and (pointer: fine) {
  [data-visual="hubmed"] .hm-tabela tr .hm-row-action { opacity: .5; transition: opacity 150ms, background 150ms, color 150ms; }
  [data-visual="hubmed"] .hm-tabela tr:is(:hover, :focus-within) .hm-row-action { opacity: 1; }
}

/* hubmed-diagramacao.css */
/* Diagramação da skin HubMed (28/10/2026). Carregada por último: uma escala só de espaço, tipo e
 * controle sobre as camadas anteriores (tema-hubmed.css e hubmed-telas.css), sem trocar a identidade
 * (navy, indigo, Inter, rótulos em caixa alta, cartões com borda colorida).
 *
 * Escala (S9, igual à Moderna no sistema-alvo de SERIE2.md):
 *          espaço 4 · 8 · 12 · 16 · 24   |   controle 32 px (denso 28)   |   raio 8 controle · 12 cartão
 *          texto 13 · apoio/rótulo 11–12, sem caixa alta · título de painel 13/600 · título da página 17 · número 21
 */
:root[data-visual="hubmed"] {
  --d1: 4px; --d2: 8px; --d3: 12px; --d4: 16px; --d5: 24px;
  --ctl: 32px; --ctl-sm: 28px;
  --r-ctl: 8px; --r-cartao: 14px;
  --t-txt: 13px; --t-apoio: 12px; --t-rot: 11px;
  --control-h: var(--ctl); --control-h-sm: var(--ctl-sm);
  --table-row-h: 38px;
  --topbar-h: 56px;
}

/* ---------- Casca ---------- */
:root[data-visual="hubmed"] .topbar { padding: 8px 16px; gap: 10px; }
:root[data-visual="hubmed"] .hm-cab-icone { width: 34px; height: 34px; border-radius: var(--r-ctl); }
:root[data-visual="hubmed"] .hm-cab-icone .ico { width: 18px; height: 18px; }
:root[data-visual="hubmed"] .topbar-title { font-size: 19px; line-height: 24px; font-weight: 800; letter-spacing: -0.4px; }
/* O subtítulo repetia o que o título e o menu já dizem. */
:root[data-visual="hubmed"] .hm-cab-sub { display: none; }
:root[data-visual="hubmed"] .hm-cab-textos { justify-content: center; }
/* A versão aparecia duas vezes no rodapé do menu. */
:root[data-visual="hubmed"] .rail .rail-versao { display: none; }
:root[data-visual="hubmed"] .main { padding: var(--d3); gap: var(--d3); }

/* ---------- Ritmo vertical das telas ---------- */
:root[data-visual="hubmed"] .hm-tela-corpo { gap: var(--d3); }
:root[data-visual="hubmed"] .hm-kpis { margin: 0; }
:root[data-visual="hubmed"] .hm-dashboard .page-scroll { display: flex; flex-direction: column; gap: var(--d3); }
:root[data-visual="hubmed"] .hm-dashboard [data-financeiro] { display: flex; flex-direction: column; gap: var(--d3); }
:root[data-visual="hubmed"] :is(.hm-dash-periodo, .hm-dash-grade) { margin: 0; }

/* ---------- Controles: mesma altura em todas as telas ---------- */
:root[data-visual="hubmed"] :is(.hm-input, .input, .select) { height: var(--ctl); border-radius: var(--r-ctl); font-size: var(--t-txt); }
:root[data-visual="hubmed"] textarea.input { height: auto; }
:root[data-visual="hubmed"] .hm-hbtn { height: var(--ctl); border-radius: var(--r-ctl); padding: 0 12px; font-size: 12px; font-weight: 700; letter-spacing: 0; }
:root[data-visual="hubmed"] .btn:not(.btn-sm) { min-height: var(--ctl); border-radius: var(--r-ctl); }
:root[data-visual="hubmed"] .btn-sm { min-height: var(--ctl-sm); border-radius: 8px; }
:root[data-visual="hubmed"] .seg { padding: 3px; border-radius: var(--r-ctl); }
:root[data-visual="hubmed"] .seg button { min-height: calc(var(--ctl) - 6px); padding: 0 10px; border-radius: 8px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
/* Selects da barra com a largura do texto: antes cortavam ("Todas as categori"). */
:root[data-visual="hubmed"] .hm-barra > .hm-campo { flex: 0 0 auto; min-width: 0; }
:root[data-visual="hubmed"] .hm-campo > select.hm-input { width: auto; min-width: 150px; max-width: 260px; padding-right: 30px; }
:root[data-visual="hubmed"] .hm-campo { gap: 3px; }
:root[data-visual="hubmed"] .hm-campo > span { font-size: var(--t-apoio); font-weight: 600; letter-spacing: 0; text-transform: none; }

/* ---------- Cartões e painéis ---------- */
:root[data-visual="hubmed"] :is(.hm-cartao, .panel) { border-radius: var(--r-cartao); }
:root[data-visual="hubmed"] .panel-head { padding: 6px 10px; min-height: 42px; align-items: center; }
:root[data-visual="hubmed"] .panel-title { font-size: var(--t-txt); font-weight: 600; letter-spacing: 0; text-transform: none; display: flex; align-items: center; gap: 6px; }
:root[data-visual="hubmed"] .panel-title > .ico { color: var(--accent); flex: none; }
:root[data-visual="hubmed"] .panel-body { padding: var(--d3); }
:root[data-visual="hubmed"] .hm-barra { padding: var(--d2) var(--d3); gap: var(--d2); }

/* ---------- Indicadores ---------- */
:root[data-visual="hubmed"] .hm-kpis { gap: var(--d2); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
:root[data-visual="hubmed"] .hm-kpi { padding: 10px 12px; gap: 2px; border-radius: var(--r-ctl); }
:root[data-visual="hubmed"] .hm-kpi-rot { font-size: var(--t-rot); font-weight: 700; letter-spacing: .4px; color: #52606d; }
:root[data-visual="hubmed"] .hm-kpi-valor { font-size: 21px; font-weight: 800; letter-spacing: -.3px; line-height: 1.2; }
:root[data-visual="hubmed"] .hm-kpi-sub { font-size: 11px; color: #71717a; }
:root[data-visual="hubmed"] .hm-kpi-ico { width: 26px; height: 26px; border-radius: 8px; }
:root[data-visual="hubmed"] .hm-kpi.is-vazio { box-shadow: none; }
:root[data-visual="hubmed"] .hm-kpi.is-vazio .hm-kpi-valor { color: #a1a1aa; }
:root[data-visual="hubmed"] .hm-kpi.is-vazio .hm-kpi-ico { filter: grayscale(1); opacity: .55; }

/* ---------- Tabelas: texto legível, linha de 38 px (34–40 do sistema-alvo), números à direita ---------- */
:root[data-visual="hubmed"] .hm-tabela { font-size: var(--t-txt); }
:root[data-visual="hubmed"] .hm-tabela th { padding: 8px 10px; font-size: var(--t-apoio); font-weight: 600; letter-spacing: 0; text-transform: none; }
:root[data-visual="hubmed"] .hm-tabela td { padding: 4px 10px; height: var(--table-row-h); }
:root[data-visual="hubmed"] .hm-tabela td.hm-d, :root[data-visual="hubmed"] .hm-tabela th.hm-d { font-variant-numeric: tabular-nums; white-space: nowrap; }
:root[data-visual="hubmed"] .hm-tabela-cartao { padding: var(--d2) var(--d3); }
:root[data-visual="hubmed"] .hm-rodape { padding-top: var(--d2); margin-top: 0; }
:root[data-visual="hubmed"] .hm-rodape-info { font-size: var(--t-apoio); font-weight: 600; letter-spacing: 0; text-transform: none; }
:root[data-visual="hubmed"] .table td { font-size: var(--t-txt); }
:root[data-visual="hubmed"] .table th { font-size: var(--t-apoio); font-weight: 600; letter-spacing: 0; text-transform: none; }
/* Relatórios: o dia ocupa o espaço; as colunas de número ficam juntas, à direita, como num extrato. */
:root[data-visual="hubmed"] .hm-relatorio .hm-tabela :is(th, td):not(:first-child) { width: 150px; }

/* ---------- Dashboard ---------- */
:root[data-visual="hubmed"] .hm-dash-periodo { padding: 6px 10px; gap: var(--d2); align-items: center; }
:root[data-visual="hubmed"] .hm-dash-periodo > .hm-dash-intervalo { margin-right: 0; }
:root[data-visual="hubmed"] .hm-dash-grade { gap: var(--d3); }
:root[data-visual="hubmed"] .hm-dash-grade.is-unico { grid-template-columns: minmax(0, 1fr); }
:root[data-visual="hubmed"] .hm-dash-exportar { margin-left: auto; }
:root[data-visual="hubmed"] .hm-dash-carregando { font-size: var(--t-apoio); color: #a1a1aa; padding: 4px 0; }
:root[data-visual="hubmed"] .hm-dash-barras { gap: 10px; }
:root[data-visual="hubmed"] .hm-dash-barras li > div { font-size: var(--t-apoio); }
:root[data-visual="hubmed"] .hm-dash-barras li > div > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root[data-visual="hubmed"] .hm-dash-grade.is-unico .hm-dash-barras { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px 24px; }
/* Nove números em grade 3×3, separados por linhas finas, sem a frase de explicação embaixo de cada um. */
:root[data-visual="hubmed"] .hm-atendimento-numeros { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); padding: 0; }
:root[data-visual="hubmed"] .hm-atendimento-numero { background: var(--surface); padding: 10px 12px; gap: 2px; border: 0 !important; cursor: help; }
:root[data-visual="hubmed"] .hm-atendimento-numero > b { font-size: 20px; line-height: 1.2; font-weight: 800; }
:root[data-visual="hubmed"] .hm-atendimento-rotulo { font-size: var(--t-rot); font-weight: 600; }
:root[data-visual="hubmed"] .hm-fila-principal { margin-bottom: var(--d3); }
:root[data-visual="hubmed"] .hm-fila-principal b { font-size: 26px; }
:root[data-visual="hubmed"] .hm-widget-icone { width: 38px; height: 38px; border-radius: var(--r-ctl); }
:root[data-visual="hubmed"] .hm-fila-detalhes b { font-size: 17px; }
:root[data-visual="hubmed"] .hm-fila-resumo .panel-body > p { margin: var(--d3) 0 0; }
:root[data-visual="hubmed"] .hm-equipe-ordem { margin-left: auto; }

/* ---------- Guias: busca, agenda, situação e filtros na mesma barra ---------- */
/* A barra de Guias vira o contêiner da busca recolhível: em barra estreita fica só a lupa, como nas outras telas. */
:root[data-visual="hubmed"] .hm-guias .op-barra { container: hm-barra / inline-size; }
:root[data-visual="hubmed"] .hm-guias .op-frescor-slot { margin-left: auto; }

/* ---------- Caixa: totais no topo, formas de pagamento numa faixa ---------- */
:root[data-visual="hubmed"] .hm-caixa-totais { gap: var(--d2); }
:root[data-visual="hubmed"] .hm-caixa-totais .hm-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
:root[data-visual="hubmed"] .hm-formas { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
:root[data-visual="hubmed"] .hm-formas li { display: inline-flex; align-items: baseline; gap: 8px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
:root[data-visual="hubmed"] .hm-formas span { font-size: var(--t-rot); font-weight: 700; color: #52606d; }
:root[data-visual="hubmed"] .hm-formas b { font-size: var(--t-txt); font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
:root[data-visual="hubmed"] .hm-formas li.is-zero { opacity: .5; }

/* ---------- Orçamentos: cartões sem quebra de número e valor ---------- */
:root[data-visual="hubmed"] .op-cards { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--d2); }
:root[data-visual="hubmed"] .op-card-topo { flex-wrap: wrap; row-gap: 4px; }
:root[data-visual="hubmed"] .op-card-topo > .strong:first-child { white-space: nowrap; }
:root[data-visual="hubmed"] .op-card-total { margin-left: auto; white-space: nowrap; }
:root[data-visual="hubmed"] .op-card-acoes { flex-wrap: nowrap; }
:root[data-visual="hubmed"] .op-card-quando { margin-right: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Configurações: as seções ficam no topo, sem a grade esticar as linhas até o fim do painel ---------- */
:root[data-visual="hubmed"] .cfg-body { align-content: start; }
:root[data-visual="hubmed"] .cfg-body.cfg-colunas { gap: var(--d4) var(--d5); }

/* ---------- Telas estreitas ---------- */
@media (max-width: 1100px) {
  :root[data-visual="hubmed"] .hm-atendimento-numeros { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  :root[data-visual="hubmed"] { --ctl: 36px; --topbar-h: 52px; }
  :root[data-visual="hubmed"] .main { padding: var(--d2); gap: var(--d2); }
  :root[data-visual="hubmed"] .topbar-title { font-size: 16px; }
  /* Cabeçalho no celular: margens menores e o título cede (ellipsis) para os botões caberem a 320 px. */
  :root[data-visual="hubmed"] .topbar { padding: 6px 8px; gap: 6px; }
  :root[data-visual="hubmed"] .topbar > .hm-cab-textos { flex: 0 1 auto; min-width: 0; }
  :root[data-visual="hubmed"] .hm-caixa-totais .hm-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  :root[data-visual="hubmed"] .hm-caixa-totais .hm-kpi-valor { font-size: 15px; }
  :root[data-visual="hubmed"] .hm-kpi-valor { font-size: 18px; }
  :root[data-visual="hubmed"] .hm-relatorio .hm-tabela :is(th, td):not(:first-child) { width: auto; }
  :root[data-visual="hubmed"] .op-cards { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Rodada de passadas (dashboard, relatórios, caixa, pacientes, catálogo, procedimentos) ----------
 * Carregada por último: as regras :root[data-visual] daqui vencem as de hubmed-telas.css e as genéricas. */

/* Dashboard: indicadores em três colunas e enxutos no celular; a legenda "no período" fica só no desktop. */
@container hm-corpo (max-width: 600px) {
  :root[data-visual="hubmed"] .hm-dashboard .hm-dash-periodo { padding: 4px 6px; }
  :root[data-visual="hubmed"] .hm-dashboard .hm-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  :root[data-visual="hubmed"] .hm-dashboard .hm-kpi { padding: 7px 9px; gap: 1px; min-width: 0; }
  :root[data-visual="hubmed"] .hm-dashboard .hm-kpi-ico,
  :root[data-visual="hubmed"] .hm-dashboard .hm-kpi-sub { display: none; }
  :root[data-visual="hubmed"] .hm-dashboard .hm-kpi-rot { font-size: 9px; line-height: 1.2; white-space: normal; }
  :root[data-visual="hubmed"] .hm-dashboard .hm-kpi-valor { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* Rodada G3 · Relatórios (barra com Financeiro, Caixa, Repasse e Categorias). Regra do dono: cabeçalho e barra de
 * filtros numa linha só, em qualquer largura (320 a 1440 px). Nenhuma aba some: a faixa de abas rola na horizontal,
 * sem barra à vista, e o degradê à direita (is-cortada, ligado por relatorios.js) avisa que há mais abas.
 * Ordem da barra: período · lupa (ou campo) · abas · Excel, PDF e Atualizar, sempre à direita.
 * Só a faixa do período, aberta pelo calendário, põe a barra em duas linhas (regra L1, mais abaixo). */
:root[data-visual="hubmed"] .hm-rel-filtros .hm-barra { flex-wrap: nowrap; }
:root[data-visual="hubmed"] .hm-rel-filtros .hm-busca-caixa { flex: 1 1 120px; min-width: 120px; max-width: 290px; margin-left: 0; }
/* ".hm-barra > " na frente deste seletor para ganhar da regra geral de ações (margin-left auto e order 20, mais abaixo). */
:root[data-visual="hubmed"] .hm-rel-filtros .hm-barra > .hm-barra-acoes { margin-left: 0; }
:root[data-visual="hubmed"] .hm-rel-filtros .hm-segmento {
  flex: 0 1 auto; min-width: 0; margin-left: auto; flex-wrap: nowrap; white-space: nowrap;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
:root[data-visual="hubmed"] .hm-rel-filtros .hm-segmento::-webkit-scrollbar { display: none; }
:root[data-visual="hubmed"] .hm-rel-filtros .hm-segmento button { flex: 0 0 auto; white-space: nowrap; }
:root[data-visual="hubmed"] .hm-rel-filtros .hm-segmento.is-cortada { mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
:root[data-visual="hubmed"] .hm-rel-filtros .hm-segmento.is-cortada.is-fim { mask-image: none; -webkit-mask-image: none; }
@container hm-barra (max-width: 600px) {
  :root[data-visual="hubmed"] .hm-rel-filtros .hm-busca-caixa:not(.is-aberta):not(.tem-valor) { flex: 0 0 auto; min-width: 0; max-width: none; }
  /* Campo aberto: ocupa até 112 px; as abas ficam com o que sobra e rolam. */
  :root[data-visual="hubmed"] .hm-rel-filtros .hm-busca-caixa:is(.is-aberta, .tem-valor) { flex: 0 1 112px; min-width: 0; max-width: none; }
  :root[data-visual="hubmed"] .hm-rel-filtros .hm-segmento { flex: 1 1 0; margin-left: 0; order: 2; }
  :root[data-visual="hubmed"] .hm-rel-filtros .hm-segmento button { padding: 5px 6px; font-size: 11px; }
  :root[data-visual="hubmed"] .hm-rel-filtros .hm-barra > .hm-barra-acoes { order: 3; margin-left: 0; }
}
/* Barra estreita (celular): as abas ganham uma linha própria, inteiras e sem rolagem lateral. */
@media (max-width: 480px) {
  :root[data-visual="hubmed"] .hm-rel-filtros .hm-barra { flex-wrap: wrap; }
  :root[data-visual="hubmed"] .hm-rel-filtros .hm-segmento { flex: 1 1 100%; order: 9; overflow: visible; mask-image: none; -webkit-mask-image: none; }
  :root[data-visual="hubmed"] .hm-rel-filtros .hm-segmento button { flex: 1 1 0; min-width: 0; }
}
/* Caixa: a busca e as ações numa linha; o período ocupa a linha de baixo, com os quatro atalhos e o calendário. */
@container hm-corpo (max-width: 600px) {
  :root[data-visual="hubmed"] .hm-barra-periodo { flex-wrap: wrap; row-gap: 6px; }
  /* O host do período é display: contents: o seletor (.res-seg) é o item da barra. */
  :root[data-visual="hubmed"] .hm-barra-periodo .res-seg { order: 1; flex: 1 1 100%; width: 100%; min-width: 0; display: flex; }
  :root[data-visual="hubmed"] .hm-barra-periodo .res-seg button { flex: 1 1 0; min-width: 0; padding-inline: 4px; }
}
@container hm-tabela (max-width: 720px) {
  /* A coluna da forma de pagamento (pílula) tem a largura do conteúdo: a pílula não invade a data. */
  :root[data-visual="hubmed"] .hm-caixa-lista .hm-tabela tr { grid-template-columns: auto minmax(max-content, 1fr) auto auto auto auto; column-gap: 4px; padding-inline: 8px; }
  :root[data-visual="hubmed"] .hm-caixa-lista .hm-tabela td:nth-child(7) { font-size: 11px; }
}

/* Pacientes: ficha e cadastro na mesma célula, lado a lado; no celular a célula ocupa a segunda linha à direita. */
@container hm-tabela (max-width: 720px) {
  :root[data-visual="hubmed"] .hm-pacientes-tabela .hm-tabela td:nth-child(3) { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
}

/* Catálogo e Procedimentos: ações secundárias em contorno, só com ícone no celular (com dica); "Novo" é o destaque. */
:root[data-visual="hubmed"] .hm-hbtn--discreto { background: #fff; color: #1f2a5b; border: 1px solid #c5cbe0; box-shadow: none; }
:root[data-visual="hubmed"] .hm-hbtn--discreto:hover:not(:disabled) { background: #f1f3f9; }
:root[data-visual="hubmed"] .hm-hbtn--discreto[aria-pressed="true"] { background: #fff8e1; color: #b45309; border-color: #ffe082; }
:root[data-visual="hubmed"] .hm-hbtn--discreto:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 767px) {
  :root[data-visual="hubmed"] .hm-tela-topo > .hm-acoes > .hm-hbtn--discreto { flex: none; }
}
@container hm-corpo (max-width: 560px) {
  :root[data-visual="hubmed"] .hm-tela-topo .hm-hbtn--discreto { width: 36px; padding: 0; }
}

/* Catálogo (Exames): o funil abre os filtros secundários em tela estreita da barra. */
.hm-funil { display: none; }
:root[data-visual="hubmed"] .hm-barra.is-filtros-abertos { flex-wrap: wrap; row-gap: 6px; } /* a própria barra é o contêiner: a regra fica fora do @container */
@container hm-barra (max-width: 600px) {
  :root[data-visual="hubmed"] .hm-barra .hm-funil { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; flex: none; }
  :root[data-visual="hubmed"] .hm-barra:not(.is-filtros-abertos) .hm-campo[data-campo] { display: none; }
  :root[data-visual="hubmed"] .hm-barra.is-filtros-abertos .hm-campo:not([hidden]) { display: flex; flex: 1 1 150px; }
}

/* ---------- Rodada 2 (hubmed-r2): topo em duas linhas, ações neutras e telas enxutas ----------
 * Catálogo e Procedimentos: linha 1 = abas/contagem e Novo; linha 2 = barra (busca, funil, ações). */
:root[data-visual="hubmed"] :is(.hm-catalogo, .hm-procedimentos) .hm-tela-topo { flex-wrap: nowrap; gap: var(--d2); }
:root[data-visual="hubmed"] :is(.hm-catalogo, .hm-procedimentos) .hm-tela-topo > .hm-acoes { width: auto; margin-left: auto; flex: none; flex-wrap: nowrap; }
:root[data-visual="hubmed"] :is(.hm-catalogo, .hm-procedimentos) .hm-tela-topo > .hm-acoes > .hm-hbtn { flex: none; }
:root[data-visual="hubmed"] :is(.hm-catalogo, .hm-procedimentos) .hm-tela-topo .hm-pilula { white-space: nowrap; }
:root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-segmento { flex: none; }

/* Ações das linhas: mesmo estilo neutro de ícone (com dica); só a ação destrutiva fica vermelha. */
:root[data-visual="hubmed"] :is(.hm-catalogo, .hm-procedimentos) .hm-row-action:is(.hm-row-action--editar, .hm-row-action--ver, .hm-row-action--neutra),
:root[data-visual="hubmed"] .hm-pacientes-tabela .hm-row-action--ver {
  background: #fff; color: #1f2a5b; border: 1px solid #c5cbe0; box-shadow: none;
}
:root[data-visual="hubmed"] :is(.hm-catalogo, .hm-procedimentos) .hm-row-action:is(.hm-row-action--editar, .hm-row-action--ver, .hm-row-action--neutra):hover:not(:disabled),
:root[data-visual="hubmed"] .hm-pacientes-tabela .hm-row-action--ver:hover {
  background: #f1f3f9; color: #1f2a5b;
}

/* Dashboard: barra de período e indicadores mais baixos; no tablet os cinco indicadores cabem numa linha. */
:root[data-visual="hubmed"] .hm-dashboard .hm-dash-periodo { padding: 3px 8px; }
:root[data-visual="hubmed"] .hm-dashboard .hm-dash-periodo > .btn-icon { width: 30px; height: 30px; min-height: 30px; }
:root[data-visual="hubmed"] .hm-dashboard .hm-kpi { padding: 7px 10px; }
:root[data-visual="hubmed"] .hm-dashboard .hm-kpi-valor { font-size: 19px; }
:root[data-visual="hubmed"] .hm-dashboard .hm-kpi-topo { min-height: 0; }
:root[data-visual="hubmed"] .hm-dashboard .panel-head { padding: 6px 12px; min-height: 36px; }
@container hm-corpo (min-width: 480px) and (max-width: 600px) {
  :root[data-visual="hubmed"] .hm-dashboard .hm-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  :root[data-visual="hubmed"] .hm-dashboard .hm-kpi { padding: 6px 7px; }
  :root[data-visual="hubmed"] .hm-dashboard .hm-kpi-valor { font-size: 13px; }
  :root[data-visual="hubmed"] .hm-dashboard .hm-kpi-rot { font-size: 9px; white-space: normal; }
}
/* Valores de dinheiro nunca são cortados: no celular os cartões viram duas colunas (o último ocupa a linha) e
 * o valor encolhe com a largura do cartão (clamp), sem reticências. */
@container hm-corpo (max-width: 479px) {
  :root[data-visual="hubmed"] .hm-dashboard .hm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :root[data-visual="hubmed"] .hm-dashboard .hm-kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  :root[data-visual="hubmed"] .hm-dashboard .hm-kpi-valor { font-size: clamp(14px, 5cqi, 19px); white-space: nowrap; overflow: visible; text-overflow: clip; }
}

/* Caixa: a faixa de formas de pagamento ocupa menos linhas (cinco colunas no tablet, três no celular). */
@container hm-corpo (max-width: 600px) {
  :root[data-visual="hubmed"] .hm-caixa-totais .hm-formas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  :root[data-visual="hubmed"] .hm-caixa-totais .hm-formas li { min-width: 0; flex-direction: column; align-items: flex-start; gap: 0; padding: 3px 8px; border-radius: 8px; }
  :root[data-visual="hubmed"] .hm-caixa-totais .hm-formas span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  :root[data-visual="hubmed"] .hm-caixa-totais .hm-formas b { font-size: 12px; white-space: nowrap; }
}
@container hm-corpo (min-width: 480px) and (max-width: 600px) {
  :root[data-visual="hubmed"] .hm-caixa-totais .hm-formas { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  :root[data-visual="hubmed"] .hm-caixa-totais .hm-formas b { font-size: 11px; }
}

/* Caixa no tablet: o período fica na mesma linha da busca (cabe na largura da coluna); no celular, na linha de baixo. */
@container hm-corpo (min-width: 480px) and (max-width: 600px) {
  :root[data-visual="hubmed"] .hm-barra-periodo { flex-wrap: nowrap; }
  :root[data-visual="hubmed"] .hm-barra-periodo .res-seg { order: 0; flex: 0 0 auto; width: auto; }
  :root[data-visual="hubmed"] .hm-barra-periodo .res-seg button { flex: 0 0 auto; padding-inline: 8px; }
}

/* Celular: "Novo" vira só o "+" (a dica traz o nome), e a linha das abas/contagem cabe numa linha. */
@container hm-corpo (max-width: 480px) {
  :root[data-visual="hubmed"] :is(.hm-catalogo, .hm-procedimentos) .hm-tela-topo .hm-hbtn--add { width: 36px; padding: 0; }
  :root[data-visual="hubmed"] :is(.hm-catalogo, .hm-procedimentos) .hm-tela-topo .hm-hbtn--add span { display: none; }
}
/* Dashboard: o espaço entre os blocos cai de 12 para 8 px (a primeira faixa de conteúdo sobe). */
:root[data-visual="hubmed"] .hm-dashboard .page-scroll { gap: var(--d2); }
/* Relatórios no tablet: os quatro indicadores numa linha só. */
@container hm-corpo (min-width: 480px) and (max-width: 600px) {
  :root[data-visual="hubmed"] .hm-rel-filtros + .hm-pilha .hm-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  :root[data-visual="hubmed"] .hm-rel-filtros + .hm-pilha .hm-kpi { padding: 6px 8px; }
  :root[data-visual="hubmed"] .hm-rel-filtros + .hm-pilha .hm-kpi-valor { font-size: 15px; }
}
/* Dashboard no desktop: indicadores um pouco mais baixos (ícone de 22 px, linha do valor mais fechada). */
:root[data-visual="hubmed"] .hm-dashboard .hm-kpi { padding: 6px 10px; }
:root[data-visual="hubmed"] .hm-dashboard .hm-kpi-ico { width: 22px; height: 22px; }
:root[data-visual="hubmed"] .hm-dashboard .hm-kpi-valor { line-height: 1.1; }
/* Pacientes em celular: cada cartão ocupa só as duas linhas do conteúdo (antes, 40 px de altura mínima por célula). */
@container hm-tabela (max-width: 720px) {
  :root[data-visual="hubmed"] .hm-pacientes-tabela .hm-tabela td { padding: 0; height: auto; min-height: 0; }
  :root[data-visual="hubmed"] .hm-pacientes-tabela .hm-tabela tr { padding: 6px 10px; gap: 1px 8px; }
  :root[data-visual="hubmed"] .hm-pacientes-tabela .hm-tabela td:nth-child(3) { align-self: center; }
}
/* Caixa em cartão: valor e repasse têm a largura do próprio texto (ex.: "Não informado" em cancelamento) e não invadem o nome. */
@container hm-tabela (max-width: 720px) {
  :root[data-visual="hubmed"] .hm-caixa-lista .hm-tabela td:is(:nth-child(8), :nth-child(9)) { min-width: max-content; overflow: visible; font-size: 12px; white-space: nowrap; }
  :root[data-visual="hubmed"] .hm-caixa-lista .hm-tabela td:nth-child(1) { min-width: max-content; overflow: visible; }
  /* Data em duas linhas (dia e hora) em vez de cortada. */
  :root[data-visual="hubmed"] .hm-caixa-lista .hm-tabela td:nth-child(7) { white-space: normal; line-height: 1.2; min-width: 52px; }
}

/* ---- Série 2 · S2/S3 (HubMed): catálogo numa linha só, filtros no funil, linha de 36px, ações no hover;
 * KPIs e cartões do dashboard em faixa baixa e sem borda colorida pesada. ---- */
:root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo { flex-wrap: nowrap; align-items: center; gap: 6px; }
:root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-busca-caixa { margin-left: auto; }
:root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-segmento button { min-height: 32px; padding: 0 12px; font-size: 12px; }
:root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > [data-contagem] { flex: none; }
:root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo .hm-hbtn:not(.hm-hbtn--add) {
  width: 32px; height: 32px; padding: 0; justify-content: center; background: none; border-color: transparent; color: #52606d;
}
:root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo .hm-hbtn:not(.hm-hbtn--add):hover { background: #f4f4f5; color: #1f2a5b; }
:root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo .hm-hbtn:not(.hm-hbtn--add) span { display: none; }
:root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo .hm-hbtn--add { height: 32px; font-size: 12px; padding: 0 12px; }
:root[data-visual="hubmed"] .hm-catalogo .hm-funil.tem-filtro { color: #3949ab; background: #e8eaf6; }
:root[data-visual="hubmed"] .hm-catalogo .hm-funil-wrap { position: relative; display: flex; }
:root[data-visual="hubmed"] .hm-catalogo .hm-funil-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; display: grid; gap: 6px; min-width: 220px; padding: 10px;
  background: #fff; border: 1px solid rgba(225,231,239,.9); border-radius: 12px; box-shadow: 0 10px 30px -12px rgba(0,0,0,.22);
}
:root[data-visual="hubmed"] .hm-catalogo .hm-funil-pop[hidden] { display: none; }
:root[data-visual="hubmed"] .hm-catalogo .hm-funil-pop .hm-input { width: 100%; }
:root[data-visual="hubmed"] .hm-catalogo .hm-tela-corpo > .hm-tabela-cartao,
:root[data-visual="hubmed"] .hm-catalogo [data-corpo] { margin-top: 6px; }
:root[data-visual="hubmed"] .hm-catalogo .hm-tabela td { height: 36px; padding: 4px 10px; }
:root[data-visual="hubmed"] .hm-catalogo .hm-discreto { font-size: 12px; color: #71717a; white-space: nowrap; }
:root[data-visual="hubmed"] .hm-catalogo .hm-row-action {
  width: 28px; height: 28px; border: 0; background: none; box-shadow: none; opacity: 1; transition: opacity .15s, background .15s;
}
:root[data-visual="hubmed"] .hm-catalogo tbody tr:hover .hm-row-action,
:root[data-visual="hubmed"] .hm-catalogo tbody tr:focus-within .hm-row-action,
:root[data-visual="hubmed"] .hm-catalogo .hm-row-action:focus-visible { opacity: 1; }
:root[data-visual="hubmed"] .hm-catalogo .hm-row-action:hover { background: #f4f4f5; }
:root[data-visual="hubmed"] .hm-catalogo .hm-row-action *,
:root[data-visual="hubmed"] .hm-catalogo .hm-hbtn * { outline: 0; border: 0; box-shadow: none; }
@container hm-tabela (max-width: 720px) {
  :root[data-visual="hubmed"] .hm-catalogo .hm-row-action { width: 40px; height: 40px; border: 0; background: none; opacity: 1; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-row-action:hover,
  :root[data-visual="hubmed"] .hm-catalogo .hm-row-action:active { background: none; }
}

/* KPIs do dashboard e cartões de número: uma faixa de até 44px (rótulo, valor e detalhe na mesma linha). */
:root[data-visual="hubmed"] .hm-kpis { gap: 8px; }
:root[data-visual="hubmed"] .hm-kpi {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 8px;
  height: 44px; max-height: 44px; padding: 0 12px; border-radius: 10px; box-shadow: none; transform: none;
  border: 1px solid rgba(225,231,239,.8); border-left: 2px solid color-mix(in srgb, var(--c) 45%, transparent);
}
:root[data-visual="hubmed"] .hm-kpi:hover { box-shadow: none; transform: none; }
:root[data-visual="hubmed"] .hm-kpi.is-destaque { border: 1px solid rgba(225,231,239,.8); border-left: 2px solid color-mix(in srgb, var(--c) 45%, transparent); }
:root[data-visual="hubmed"] .hm-kpi-topo { display: contents; }
:root[data-visual="hubmed"] .hm-kpi-ico { display: none; }
:root[data-visual="hubmed"] .hm-kpi-rot { font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
:root[data-visual="hubmed"] .hm-kpi-valor { font-size: 15px; font-weight: 800; line-height: 1; white-space: nowrap; }
:root[data-visual="hubmed"] .hm-kpi-sub { display: none; }
:root[data-visual="hubmed"] .res-stat { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 8px; height: 44px; max-height: 44px; padding: 0 2px; border-top: 0; }
:root[data-visual="hubmed"] .res-stat-cab { font-size: 11px; }
:root[data-visual="hubmed"] .res-stat-cab > svg { display: none; }
:root[data-visual="hubmed"] .res-stat-num { font-size: 15px; line-height: 1; }
:root[data-visual="hubmed"] .res-stat-det { font-size: 11px; }
@media (max-width: 760px) {
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo { flex-wrap: wrap; row-gap: 6px; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > [data-contagem] { display: none; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-segmento { flex: 0 0 auto; width: auto; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-segmento button { flex: 0 0 auto; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-busca-caixa { margin-left: 0; flex: 1 1 120px; min-width: 120px; max-width: none; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-busca-caixa .hm-busca { width: 100%; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-acoes { margin-left: 0; }
}
:root[data-visual="hubmed"] .hm-catalogo .hm-funil { display: inline-grid; place-items: center; }
:root[data-visual="hubmed"] .hm-catalogo .hm-row-action:is(.hm-row-action--editar, .hm-row-action--ver, .hm-row-action--neutra, .hm-row-action--excluir) { background: none; border: 0; box-shadow: none; }
:root[data-visual="hubmed"] .hm-catalogo tbody .hm-row-action:is(.hm-row-action--editar, .hm-row-action--ver, .hm-row-action--neutra):hover:not(:disabled) { background: #f4f4f5; color: #1f2a5b; }

/* Passada S3/S4 (dashboard): faixa de indicadores, barras finas numa linha, atendimento e fila em faixas baixas.
 * Seletores só das telas do dashboard (.hm-dashboard, .hm-dash-*, .hm-atendimento-*, .hm-fila-*, .hm-equipe-*). */
:root[data-visual="hubmed"] .hm-dashboard { text-transform: none; }
:root[data-visual="hubmed"] .hm-dashboard .page-scroll { gap: 8px; }
:root[data-visual="hubmed"] .hm-dashboard .hm-dash-periodo { padding: 6px 10px; margin-bottom: 0; gap: 8px; }
:root[data-visual="hubmed"] .hm-dashboard .hm-dash-intervalo { font-size: 11px; }
:root[data-visual="hubmed"] .hm-dashboard [data-financeiro] { gap: 8px; }
:root[data-visual="hubmed"] .hm-dash-faixa { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; }
:root[data-visual="hubmed"] .hm-dashboard .hm-dash-faixa .hm-kpi { display: flex; grid-template-columns: none; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; height: 36px; padding: 0 10px; border-radius: 8px; min-width: 0; box-shadow: none; }
:root[data-visual="hubmed"] .hm-dashboard .hm-dash-faixa .hm-kpi:hover { transform: none; box-shadow: none; }
:root[data-visual="hubmed"] .hm-dash-kpi-rot { font-size: 11px; font-weight: 600; color: #52606d; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root[data-visual="hubmed"] .hm-dash-kpi-valor { font-size: 14px; font-weight: 800; color: var(--c); white-space: nowrap; font-variant-numeric: tabular-nums; }
:root[data-visual="hubmed"] .hm-dashboard .hm-dash-faixa .hm-kpi.is-vazio .hm-dash-kpi-valor { color: #a1a1aa; }
:root[data-visual="hubmed"] .hm-dash-grade { gap: 8px; }
:root[data-visual="hubmed"] .hm-dash-bloco .panel-head { min-height: 34px; padding: 6px 10px; }
:root[data-visual="hubmed"] .hm-dash-bloco .panel-body { padding: 8px 10px; }
:root[data-visual="hubmed"] .hm-dash-barras { display: flex; flex-direction: column; gap: 3px; }
:root[data-visual="hubmed"] .hm-dash-barras li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(64px, .9fr) auto; align-items: center; gap: 10px; min-height: 22px; font-size: 12px; }
:root[data-visual="hubmed"] .hm-dash-barras .hm-dash-nome { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
:root[data-visual="hubmed"] .hm-dash-barras progress { height: 3px; margin: 0; }
:root[data-visual="hubmed"] .hm-dash-barras li > b { font-size: 12px; font-weight: 700; min-width: 2.5em; text-align: right; font-variant-numeric: tabular-nums; }
:root[data-visual="hubmed"] .hm-dash-grade.is-unico .hm-dash-barras { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 3px 24px; }
/* Atendimentos: uma faixa de células baixas, sem ícones */
:root[data-visual="hubmed"] .hm-dashboard .hm-atendimento-numeros { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 0; }
:root[data-visual="hubmed"] .hm-dashboard .hm-atendimento-numero { padding: 6px 8px; gap: 0; }
:root[data-visual="hubmed"] .hm-dashboard .hm-atendimento-rotulo { font-size: 10px; color: var(--ink-soft); }
:root[data-visual="hubmed"] .hm-dashboard .hm-atendimento-rotulo > svg, :root[data-visual="hubmed"] .hm-dashboard .hm-atendimento-rotulo > .ico { display: none; }
:root[data-visual="hubmed"] .hm-dashboard .hm-atendimento-numero > b { font-size: 15px; line-height: 1.3; }
/* Fila agora: uma linha de resumo */
:root[data-visual="hubmed"] .hm-dashboard .hm-fila-principal { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
:root[data-visual="hubmed"] .hm-dashboard .hm-fila-principal > .hm-widget-icone { display: none; }
:root[data-visual="hubmed"] .hm-dashboard .hm-fila-principal > div { flex-direction: row; align-items: baseline; gap: 6px; }
:root[data-visual="hubmed"] .hm-dashboard .hm-fila-principal b { font-size: 15px; }
:root[data-visual="hubmed"] .hm-dashboard .hm-fila-detalhes { display: flex; gap: 14px; padding-top: 0; border-top: 0; }
:root[data-visual="hubmed"] .hm-dashboard .hm-fila-detalhes > div { flex-direction: row; align-items: baseline; gap: 6px; }
:root[data-visual="hubmed"] .hm-dashboard .hm-fila-detalhes b { font-size: 13px; }
:root[data-visual="hubmed"] .hm-dashboard .hm-fila-equipe { margin-top: 6px; gap: 4px; }
/* Por atendente: uma linha densa por pessoa (cartão achatado em grade) */
:root[data-visual="hubmed"] .hm-dashboard .hm-equipe-painel .panel-body { padding: 0; }
:root[data-visual="hubmed"] .hm-dashboard .hm-dash-faixa .hm-kpi { text-decoration: none; }
:root[data-visual="hubmed"] .hm-dashboard .hm-dash-faixa .hm-kpi:hover { text-decoration: none; }
:root[data-visual="hubmed"] .hm-dashboard .hm-atendimento-numeros { background: transparent; }
:root[data-visual="hubmed"] .hm-dashboard .hm-atendimento-numero { background: transparent; border-top: 1px solid var(--line) !important; border-left: 0 !important; }
/* Caixa (S3): selos em caixa baixa e cancelado só na linha */
:root[data-visual="hubmed"] .hm-caixa-lista .hm-selo { text-transform: none; }
:root[data-visual="hubmed"] .hm-caixa-lista tr.is-cancelada td { color: var(--ink-soft); }
:root[data-visual="hubmed"] .hm-formas span { text-transform: none; }
/* Mensagens (S3): status e ações discretos; ações da linha sobem no hover ou foco */
:root[data-visual="hubmed"] .hm-tela-mensagens .hm-selo { font-size: 11px; font-weight: 600; padding: 1px 8px; }
:root[data-visual="hubmed"] .hm-tela-mensagens .hm-row-action { opacity: .5; transition: opacity .15s; }
:root[data-visual="hubmed"] .hm-tela-mensagens tbody tr:hover .hm-row-action, :root[data-visual="hubmed"] .hm-tela-mensagens tbody tr:focus-within .hm-row-action { opacity: 1; }
@media (max-width: 760px) {
  :root[data-visual="hubmed"] .hm-dashboard .hm-dash-faixa { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :root[data-visual="hubmed"] .hm-dashboard .hm-dash-faixa .hm-kpi { display: flex; grid-template-columns: none; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; height: auto; min-height: 36px; padding: 5px 8px; }
  :root[data-visual="hubmed"] .hm-dashboard .hm-dash-faixa .hm-dash-kpi-valor { font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  :root[data-visual="hubmed"] .hm-dashboard .hm-dash-faixa .hm-kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* Rodada S5 (atendimento, datas de guias, linha clicável). Só as telas do dashboard de atendimento,
 * Datas de guias e tabelas com abrirPor (Pacientes, Mensagens, Exames, Prestadores, Procedimentos). */
:root[data-visual="hubmed"] .hm-dash-atendimento .hm-atendimento-numeros { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: 0; padding: 0; background: none; }
:root[data-visual="hubmed"] .hm-dash-atendimento .hm-atendimento-numero { flex-direction: row; align-items: baseline; justify-content: space-between; gap: 8px; padding: 6px 10px; min-width: 0; background: none; border: 0 !important; border-left: 1px solid var(--line) !important; cursor: default; }
:root[data-visual="hubmed"] .hm-dash-atendimento .hm-atendimento-numero:first-child { border-left: 0 !important; }
:root[data-visual="hubmed"] .hm-dash-atendimento .hm-atendimento-rotulo { font-size: 11px; font-weight: 600; color: var(--ink-soft); min-width: 0; }
:root[data-visual="hubmed"] .hm-dash-atendimento .hm-atendimento-rotulo > .ico { display: none; }
:root[data-visual="hubmed"] .hm-dash-atendimento .hm-atendimento-numero > b { font-size: 14px; line-height: 1.2; white-space: nowrap; }
:root[data-visual="hubmed"] .hm-dash-atendimento .hm-equipe-tabela { border: 0; box-shadow: none; background: none; }
:root[data-visual="hubmed"] .hm-dash-atendimento .hm-equipe-tabela td { white-space: nowrap; }
:root[data-visual="hubmed"] .hm-guia-busca { flex-direction: row; align-items: center; gap: 8px; padding: 8px 10px; text-align: left; }
:root[data-visual="hubmed"] .hm-guia-busca[hidden] { display: none; }
:root[data-visual="hubmed"] .hm-guia-busca .hm-busca { flex: 1 1 auto; min-width: 0; max-width: 420px; }
:root[data-visual="hubmed"] .hm-guia-busca .hm-input { width: 100%; }
:root[data-visual="hubmed"] .hm-tela .hm-tabela tbody tr.is-clicavel { cursor: pointer; }
:root[data-visual="hubmed"] .hm-tela .hm-tabela tbody tr.is-clicavel:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- Celular (S7): indicadores sem valor cortado ----------
 * Na faixa de 44px o rótulo e o valor dividem a mesma linha e o valor vira reticências ("R$ 7.1…").
 * Abaixo de 480px cada indicador é um cartão em coluna (rótulo em cima, valor embaixo, inteiro) e
 * a grade é de duas colunas; o último ímpar ocupa a largura toda. O caixa mantém as três colunas. */
@container hm-corpo (max-width: 479px) {
  :root[data-visual="hubmed"] .hm-kpis:not(.hm-caixa-totais .hm-kpis) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  :root[data-visual="hubmed"] .hm-kpis:not(.hm-caixa-totais .hm-kpis) > .hm-kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  :root[data-visual="hubmed"] .hm-kpi { display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 0; height: auto; max-height: none; min-height: 44px; padding: 5px 8px; column-gap: 0; }
  :root[data-visual="hubmed"] .hm-kpi-rot { font-size: 10px; line-height: 1.25; white-space: normal; overflow-wrap: anywhere; }
  :root[data-visual="hubmed"] .hm-kpi-valor { font-size: clamp(13px, 4.2cqi, 17px); line-height: 1.25; white-space: nowrap; overflow: visible; text-overflow: clip; }
  :root[data-visual="hubmed"] .hm-caixa-totais .hm-kpi { flex-direction: column; align-items: stretch; height: auto; min-height: 0; padding: 6px 8px; }
  :root[data-visual="hubmed"] .hm-caixa-totais .hm-kpi-valor { font-size: clamp(12px, 3.9cqi, 15px); }
}

/* ---------- Rodada L1 (cabeçalhos e filtros HubMed: uma linha de 1440 a 320 px) ----------
 * Quando a linha da barra não cabe, o período abre numa faixa pelo calendário e os demais filtros pelo funil
 * (botaoFaixa e faixasDaBarra em comum.js). A barra segue numa linha; a faixa aberta vira uma segunda linha,
 * só enquanto estiver aberta. Os limiares são a largura da própria barra (container hm-barra). */
:root[data-visual="hubmed"] .hm-dash-periodo { container: hm-barra / inline-size; }
:root[data-visual="hubmed"] .hm-faixa-btn { display: none; }
:root[data-visual="hubmed"] .hm-faixa-btn[aria-expanded="true"] { background: #e8eaf6; color: #3949ab; border-color: #c5cae9; }

/* Barra com a faixa do período aberta: quebra de linha (a barra é o próprio contêiner, por isso fica fora do @container). */
:root[data-visual="hubmed"] :is(.hm-barra, .op-barra, .hm-dash-periodo):has(:is(.res-seg-cal[aria-expanded="true"], .res-seg > button:not(.res-seg-cal):is(:focus, :active))) { flex-wrap: wrap; }

/* ---------- Rodada D1 (período): um ícone só, o calendário ----------
 * O calendário abre o período personalizado e, ao lado dele, os atalhos Hoje, 7, 30 e 90 dias. Em tela estreita
 * a faixa fica numa linha cheia logo abaixo da barra. A faixa está aberta enquanto o calendário estiver aberto
 * (aria-expanded) ou um atalho estiver com foco: o clique no atalho fecha o calendário, e o foco mantém a faixa
 * até o clique aplicar o período. O botão de faixa antigo (comum.js, guias, dashboard) fica oculto: duplicava o ícone. */
:root[data-visual="hubmed"] :is(.hm-barra, .op-barra, .hm-dash-periodo) .res-seg > button.res-seg-cal { order: -1; flex: 0 0 auto; }
@container hm-barra (max-width: 900px) {
  :root[data-visual="hubmed"] :is(.hm-barra, .op-barra, .hm-dash-periodo):not(:has(:is(.res-seg-cal[aria-expanded="true"], .res-seg > button:not(.res-seg-cal):is(:focus, :active)))) [data-na-faixa="periodo"] button:not(.res-seg-cal) { display: none; }
  :root[data-visual="hubmed"] :is(.hm-barra, .op-barra, .hm-dash-periodo):not(:has(:is(.res-seg-cal[aria-expanded="true"], .res-seg > button:not(.res-seg-cal):is(:focus, :active)))) :is([data-na-faixa="periodo"] .res-seg, .res-seg[data-na-faixa="periodo"]) { flex: 0 0 auto; width: auto; min-width: 0; order: 0; }
  :root[data-visual="hubmed"] :is(.hm-barra, .op-barra, .hm-dash-periodo):has(:is(.res-seg-cal[aria-expanded="true"], .res-seg > button:not(.res-seg-cal):is(:focus, :active))) > [data-na-faixa="periodo"] { display: flex; flex: 1 1 100%; width: 100%; min-width: 0; order: 30; }
  :root[data-visual="hubmed"] :is(.hm-barra, .op-barra, .hm-dash-periodo) > [data-na-faixa="periodo"] > .res-seg { flex: 1 1 auto; width: 100%; min-width: 0; }
}
@container hm-barra (max-width: 560px) {
  :root[data-visual="hubmed"] .hm-faixa-btn[data-faixa-btn="filtros"] { display: inline-grid; place-items: center; }
  :root[data-visual="hubmed"] :is(.hm-barra, .op-barra) > [data-na-faixa="filtros"] { display: none; }
  :root[data-visual="hubmed"] :is(.hm-barra, .op-barra).is-faixa-filtros { flex-wrap: wrap; }
  :root[data-visual="hubmed"] :is(.hm-barra, .op-barra).is-faixa-filtros > [data-na-faixa="filtros"] { display: flex; flex: 1 1 100%; width: 100%; min-width: 0; order: 31; }
}
/* Telas que tinham a barra em duas linhas por regra própria: fechada, a barra fica numa linha só. */
:root[data-visual="hubmed"] :is(.hm-tela-mensagens, .hm-tela-logs, .hm-contas-pagar, [data-tela="caixa"]) .hm-barra:not(.is-faixa-periodo):not(.is-faixa-filtros):not(:has(:is(.res-seg-cal[aria-expanded="true"], .res-seg > button:not(.res-seg-cal):is(:focus, :active)))) { flex-wrap: nowrap; }


/* Ações secundárias das barras (Excel, PDF, Atualizar): só o ícone, sem cor de fundo; o título diz a função. */
:root[data-visual="hubmed"] :is(.hm-contas-pagar, .hm-tela-mensagens, .hm-tela-logs, .hm-afiliados, [data-tela="relatorios"], [data-tela="caixa"]) .hm-barra-acoes :is(.hm-hbtn--refresh, .hm-hbtn--pdf) {
  background: #fff; color: #1f2a5b; border: 1px solid #c5cbe0; box-shadow: none;
}
:root[data-visual="hubmed"] :is(.hm-contas-pagar, .hm-tela-mensagens, .hm-tela-logs, .hm-afiliados, [data-tela="relatorios"], [data-tela="caixa"]) .hm-barra-acoes :is(.hm-hbtn--refresh, .hm-hbtn--pdf):hover:not(:disabled) {
  background: #f1f3f9; color: #1f2a5b;
}

/* Barra de Guias: fechada, fica numa linha (o funil abre a sua faixa; a faixa do período também).
 * Em barra estreita, as situações viram só ícone (com título) e os botões de ícone ficam em 32 px. */
:root[data-visual="hubmed"] .hm-guias .op-barra:not(.is-faixa-periodo):not(.funil-aberto):not(:has(:is(.res-seg-cal[aria-expanded="true"], .res-seg > button:not(.res-seg-cal):is(:focus, :active)))) { flex-wrap: nowrap; }
@container hm-barra (max-width: 480px) {
  :root[data-visual="hubmed"] .hm-guias .op-sit .op-sit-txt { display: none; }
  :root[data-visual="hubmed"] .hm-guias .op-sit button { padding: 3px 7px; }
  :root[data-visual="hubmed"] .hm-guias .op-barra { gap: 4px; padding: 6px; }
  :root[data-visual="hubmed"] .hm-guias .op-barra .hm-faixa-btn,
  :root[data-visual="hubmed"] .hm-guias .op-barra .op-hbtn-contorno { width: 32px; padding: 0; justify-content: center; }
  :root[data-visual="hubmed"] .hm-guias .op-vistas button { padding: 3px 6px; }
}
@container hm-corpo (max-width: 900px) {
  /* O CPF sai da célula da tabela (fica no título da célula): a coluna Ações cabe ao lado do ⋯. */
  :root[data-visual="hubmed"] .hm-guias-tabela .op-cpf { display: none; }
}

/* Guias: Cancelar guia sai da linha da tabela e fica no ⋯ quando a tabela é estreita (hm-guias.js › acoesEmMais).
 * Largo: o botão fica na linha, como estava. Estreito: o ⋯ abre o botão logo abaixo, na mesma linha de guia. */
.hm-mais { display: contents; }
.hm-mais-btn { display: none; }
@container hm-corpo (max-width: 900px) {
  :root[data-visual="hubmed"] .hm-guias-tabela .hm-mais { display: inline-flex; flex-direction: column; align-items: flex-end; }
  :root[data-visual="hubmed"] .hm-guias-tabela .hm-mais-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; }
  :root[data-visual="hubmed"] .hm-guias-tabela .hm-mais-pop { display: none; }
  :root[data-visual="hubmed"] .hm-guias-tabela .hm-mais.is-aberto .hm-mais-pop { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
}

/* Tabela de guias (lote B): a tabela ocupa a largura do painel em qualquer janela, sem rolagem da página.
 * Colunas curtas têm largura fixa por faixa de largura do painel; Paciente e Prestador dividem a sobra e
 * cortam o fim do texto com reticências (o nome completo fica no title). Abaixo de 768 px da janela, a
 * tabela vira cartões (bloco logo abaixo). Status: ícone e sem forma de pagamento na tabela estreita. */
@media (min-width: 768px) {
  :root[data-visual="hubmed"] .hm-guias-tabela table.op-table { table-layout: fixed; width: 100%; }
  :root[data-visual="hubmed"] .hm-guias-tabela .op-table :is(th, td) { box-sizing: border-box; padding-left: 8px; padding-right: 8px; }
  @container (max-width: 599px) { :root[data-visual="hubmed"] .hm-guias-tabela .op-table :is(th, td) { padding-left: 6px; padding-right: 6px; } }
  :root[data-visual="hubmed"] .hm-guias-tabela .op-table td { white-space: nowrap; }
  :root[data-visual="hubmed"] .hm-guias-tabela .op-table td > .ellipsis { max-width: 100%; min-width: 0; }
  :root[data-visual="hubmed"] .hm-guias-tabela .op-so-larga { display: table-cell; }
  :root[data-visual="hubmed"] .hm-guias-tabela :is(th, td).op-col-cli,
  :root[data-visual="hubmed"] .hm-guias-tabela :is(th, td).op-col-prest { width: auto; }
  @container (min-width: 900px) {
    :root[data-visual="hubmed"] .hm-guias-tabela :is(th, td).op-col-guia { width: 76px; }
    :root[data-visual="hubmed"] .hm-guias-tabela :is(th, td).op-col-data { width: 100px; }
    :root[data-visual="hubmed"] .hm-guias-tabela :is(th, td).op-col-total { width: 112px; }
    :root[data-visual="hubmed"] .hm-guias-tabela :is(th, td).op-col-pag { width: 140px; }
    :root[data-visual="hubmed"] .hm-guias-tabela :is(th, td).op-col-acoes { width: 120px; }
    :root[data-visual="hubmed"] .hm-guias-tabela .op-pag { flex-wrap: nowrap; min-width: 0; }
    :root[data-visual="hubmed"] .hm-guias-tabela .op-pag .faint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  }
  @container (min-width: 600px) and (max-width: 899px) {
    :root[data-visual="hubmed"] .hm-guias-tabela :is(th, td).op-col-guia { width: 68px; }
    :root[data-visual="hubmed"] .hm-guias-tabela :is(th, td).op-col-data { width: 88px; }
    :root[data-visual="hubmed"] .hm-guias-tabela :is(th, td).op-col-total { width: 92px; }
    :root[data-visual="hubmed"] .hm-guias-tabela :is(th, td).op-col-pag { width: 84px; }
    :root[data-visual="hubmed"] .hm-guias-tabela :is(th, td).op-col-acoes { width: 104px; }
    :root[data-visual="hubmed"] .hm-guias-tabela .op-pag .faint { display: none; }
  }
  @container (max-width: 599px) {
    :root[data-visual="hubmed"] .hm-guias-tabela :is(th, td).op-col-guia { width: 56px; }
    :root[data-visual="hubmed"] .hm-guias-tabela :is(th, td).op-col-data { width: 80px; }
    :root[data-visual="hubmed"] .hm-guias-tabela :is(th, td).op-col-total { width: 80px; }
    :root[data-visual="hubmed"] .hm-guias-tabela :is(th, td).op-col-pag { width: 44px; }
    :root[data-visual="hubmed"] .hm-guias-tabela :is(th, td).op-col-acoes { width: 84px; }
    :root[data-visual="hubmed"] .hm-guias-tabela .op-pag .faint { display: none; }
    :root[data-visual="hubmed"] .hm-guias-tabela .hm-st-ico { display: inline-flex; }
    :root[data-visual="hubmed"] .hm-guias-tabela .hm-st-txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    :root[data-visual="hubmed"] .hm-guias-tabela .op-pag .badge { position: relative; padding: 0 4px; }
    :root[data-visual="hubmed"] .hm-guias-tabela .op-motivo { display: none; }
  }
}

/* Cartões de guia (celular, até 767 px da janela): Ações, que antes sumia, vira a última linha do cartão. */
@media (max-width: 767px) {
  html:root[data-visual="hubmed"] .hm-guias-tabela .op-table.op-guias td[data-label="Ações"] { display: flex; justify-content: flex-end; align-items: center; grid-column: 1 / -1; grid-row: 4; padding-top: 2px; }
  html:root[data-visual="hubmed"] .hm-guias-tabela .op-table.op-guias .op-acoes { justify-content: flex-end; gap: 4px; }
}

/* Cartões de Contas e Mensagens em modo ficha: cada célula deixa 14 px de vão à direita; uma célula sozinha no fim
 * da linha passava dessa largura em 3 px e criava uma rolagem que não existe. O limite conta o vão. */
@container hm-tabela (max-width: 720px) {
  :root[data-visual="hubmed"] :is(.hm-contas-pagar, .hm-tela-mensagens) .hm-tabela td { max-width: calc(100% - 14px); }
}

/* Indicadores em 390 px: uma faixa de colunas que cabem (rótulo em cima, valor embaixo), sem empilhar em coluna. */
@container hm-corpo (max-width: 479px) {
  :root[data-visual="hubmed"] :is(.hm-contas-pagar, .hm-tela-mensagens, .hm-afiliados, [data-tela="relatorios"]) .hm-kpis:not(.hm-caixa-totais .hm-kpis) { grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 4px; }
  :root[data-visual="hubmed"] :is(.hm-contas-pagar, .hm-tela-mensagens, .hm-afiliados, [data-tela="relatorios"]) .hm-kpis:not(.hm-caixa-totais .hm-kpis) > .hm-kpi:last-child:nth-child(odd) { grid-column: auto; }
  :root[data-visual="hubmed"] :is(.hm-contas-pagar, .hm-tela-mensagens, .hm-afiliados, [data-tela="relatorios"]) .hm-kpi { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; height: auto; max-height: none; min-height: 42px; padding: 4px 8px; min-width: 0; }
  :root[data-visual="hubmed"] :is(.hm-contas-pagar, .hm-tela-mensagens, .hm-afiliados, [data-tela="relatorios"]) .hm-kpi-rot { font-size: 10px; line-height: 1.2; white-space: normal; overflow: visible; text-overflow: clip; }
  :root[data-visual="hubmed"] :is(.hm-contas-pagar, .hm-tela-mensagens, .hm-afiliados, [data-tela="relatorios"]) .hm-kpi-valor { font-size: 13px; line-height: 1.2; white-space: nowrap; overflow: visible; text-overflow: clip; }
  :root[data-visual="hubmed"] .hm-dashboard .hm-dash-faixa { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  :root[data-visual="hubmed"] .hm-dashboard .hm-dash-faixa .hm-kpi { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; height: auto; min-height: 40px; padding: 4px 8px; }
  :root[data-visual="hubmed"] .hm-dashboard .hm-dash-faixa .hm-kpi:last-child:nth-child(odd) { grid-column: auto; }
  :root[data-visual="hubmed"] .hm-dashboard .hm-dash-faixa .hm-dash-kpi-rot { font-size: 10px; white-space: normal; overflow: visible; text-overflow: clip; }
  :root[data-visual="hubmed"] .hm-dashboard .hm-dash-faixa .hm-dash-kpi-valor { font-size: 13px; white-space: nowrap; overflow: visible; text-overflow: clip; }
  :root[data-visual="hubmed"] .hm-guias .op-resumo { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 0; padding: 4px 8px; }
  :root[data-visual="hubmed"] .hm-guias .op-resumo .kpi { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; min-width: 0; padding: 2px 6px; }
  :root[data-visual="hubmed"] .hm-guias .op-resumo .kpi-num { font-size: 13px; white-space: nowrap; }
  :root[data-visual="hubmed"] .hm-guias .op-resumo .kpi-rot { font-size: 10px; white-space: normal; }
}

/* ---------- Rodada R2-B (catálogo e guias canceladas): cabeçalho e filtros numa linha, de 1440 a 320 px ----------
 * Catálogo: abas compactas e sem quebra; controles de 32 px; a busca recolhe na lupa e, aberta, ocupa a linha de baixo.
 * Em barra estreita (menos de 600 px), Correção e Reajustar vão para o funil (catalogo.js › arrumarAcoes), com rótulo.
 * Guias canceladas: o período abre na faixa do calendário (regra "Rodada L1" acima). */
:root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-segmento { flex: 0 0 auto; width: auto; }
:root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-segmento button { flex: 0 0 auto; min-height: 32px; padding: 0 12px; font-size: 12px; white-space: nowrap; }
:root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo .hm-hbtn:not(.hm-hbtn--add) { width: 32px; height: 32px; min-height: 32px; padding: 0; }
:root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo .hm-hbtn--add { height: 32px; min-height: 32px; padding: 0 12px; }
/* No funil, Correção e Reajuste são linhas com rótulo (o topo as deixa só com ícone). Especificidade igual à do topo, e esta regra vem depois. */
:root[data-visual="hubmed"] .hm-catalogo .hm-funil-pop .hm-hbtn:not(.hm-hbtn--add) { width: 100%; height: 32px; min-height: 32px; padding: 0 10px; justify-content: flex-start; font-size: 12px; background: #fff; border: 1px solid #c5cbe0; color: #1f2a5b; }
:root[data-visual="hubmed"] .hm-catalogo .hm-funil-pop .hm-hbtn:not(.hm-hbtn--add):hover:not(:disabled) { background: #f1f3f9; }
:root[data-visual="hubmed"] .hm-catalogo .hm-funil-pop .hm-hbtn:not(.hm-hbtn--add) span { display: inline; }
@container hm-corpo (max-width: 600px) {
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo { flex-wrap: wrap; gap: 4px; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-segmento { gap: 2px; padding: 3px; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-segmento button { padding: 0 6px; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > [data-contagem] { display: none; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-busca-caixa { flex: 0 0 auto; min-width: 0; max-width: none; margin-left: auto; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-busca-caixa .hm-busca-lupa { display: inline-grid; width: 32px; height: 32px; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-busca-caixa:not(.is-aberta):not(.tem-valor) .hm-busca { display: none; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-busca-caixa:is(.is-aberta, .tem-valor) .hm-busca-lupa { display: none; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo > .hm-busca-caixa:is(.is-aberta, .tem-valor) { flex: 1 1 100%; order: 9; max-width: none; }
  :root[data-visual="hubmed"] .hm-catalogo .hm-tela-topo .hm-hbtn--add { width: 32px; padding: 0; }
}
/* Guias canceladas: com a faixa do período aberta, a barra quebra e o período ocupa a linha de baixo, com os quatro
 * atalhos e o calendário cabendo na largura (a barra é o próprio contêiner, então a quebra vale fora do @container). */
:root[data-visual="hubmed"] .hm-guias-canceladas .hm-barra.is-faixa-periodo { flex-wrap: wrap; }
@container hm-barra (max-width: 900px) {
  :root[data-visual="hubmed"] .hm-guias-canceladas [data-na-faixa="periodo"] .res-seg { display: flex; width: 100%; }
  :root[data-visual="hubmed"] .hm-guias-canceladas [data-na-faixa="periodo"] .res-seg button { flex: 1 1 0; min-width: 0; padding-inline: 4px; }
}

/* ---------- Rodada 3 · lote R3-4 (mensagens, pacientes, afiliados) ---------- */
/* Mensagens: a contagem de cada aba (Recebidas, Novas, Lidas, Respondidas) fica discreta ao lado do rótulo. */
:root[data-visual="hubmed"] .hm-segmento .hm-seg-n:not(:empty) { margin-left: 4px; font-size: 11px; font-weight: 600; opacity: .75; font-variant-numeric: tabular-nums; }
/* Pacientes: ações da linha só com ícone, 32 px, sem caixa. Visíveis em repouso, na cor da função (ac-abrir, ac-ligar, ac-desligar). */
:root[data-visual="hubmed"] .hm-pacientes-tabela .hm-row-action { width: 32px; height: 32px; border: 0; background: none; box-shadow: none; opacity: 1; transition: background-color .15s; }
:root[data-visual="hubmed"] .hm-pacientes-tabela .hm-row-action::after { inset: 0; }
:root[data-visual="hubmed"] .hm-pacientes-tabela .hm-row-action:hover:not(:disabled) { background: #f4f4f5; }
/* Afiliados: "Novo afiliado" mostra o texto no desktop; no celular fica só o "+" (com title e aria-label). */
:root[data-visual="hubmed"] .hm-afiliados .hm-barra-acoes .hm-hbtn--add span { display: inline; }
@media (min-width: 768px) { :root[data-visual="hubmed"] .hm-afiliados .hm-barra-acoes .hm-hbtn--add { width: auto; min-width: max-content; flex: none; padding: 0 12px; white-space: nowrap; } }
@media (max-width: 767px) { :root[data-visual="hubmed"] .hm-afiliados .hm-barra-acoes .hm-hbtn--add span { display: none; } }

/* ---------- Rodada D1 (barra de ações): Excel verde e Atualizar à direita ---------- */
/* Excel: verde de sucesso em todas as telas com o botão (cheio, com texto e ícone brancos: 5,3:1; hover 6,1:1). */
:root[data-visual="hubmed"] .hm-hbtn--excel,
:root[data-visual="hubmed"] .hm-barra-acoes .hm-hbtn--excel { background: #257a4f; border-color: #257a4f; color: #fff; }
:root[data-visual="hubmed"] .hm-hbtn--excel:hover:not(:disabled),
:root[data-visual="hubmed"] .hm-barra-acoes .hm-hbtn--excel:hover:not(:disabled) { background: #1f6f4a; border-color: #1f6f4a; color: #fff; }
:root[data-visual="hubmed"] .hm-hbtn--excel:focus-visible { outline: 2px solid #1f6f4a; outline-offset: 2px; }
/* Exportar de cada painel do dashboard: ícone verde escuro (6,3:1 sobre branco). */
:root[data-visual="hubmed"] .hm-dash-exportar { color: #1e6d41; }
:root[data-visual="hubmed"] .hm-dash-exportar:hover:not(:disabled) { background: #e8f5e9; color: #185c3c; }
/* Dashboard: Atualizar vai para o canto direito da barra de período. */
:root[data-visual="hubmed"] .hm-dash-periodo > [data-atualizar] { margin-left: auto; }
/* Ações sempre à direita, também quando a barra quebra em tela estreita; o grupo da esquerda (busca, período) fica à esquerda. */
:root[data-visual="hubmed"] .hm-barra > .hm-barra-acoes { margin-left: auto; order: 20; }
:root[data-visual="hubmed"] .hm-barra > .hm-busca-caixa { margin-left: 0; }
/* O calendário é o alvo de toque do período: pelo menos 36 px de largura. */
:root[data-visual="hubmed"] :is(.hm-barra, .op-barra, .hm-dash-periodo) .res-seg > button.res-seg-cal { min-width: 36px; }
/* Guias e Agenda trazem data-op-na-faixa (barra.js e agenda.js), que a Operação esconde em tela estreita: aqui o período
 * fica na barra. Só essas duas: Orçamentos usa a mesma barra e precisa da faixa do período abaixo de 480 px (operacao.css). */
:root[data-visual="hubmed"] :is(.hm-guias .op-barra, .op-agenda-barra) > [data-op-na-faixa="periodo"] { display: contents; }

/* Lote Vida 3 (Guias, Caixa, Contas a pagar, Mensagens, Logs, Atendimento): ações de linha visíveis e com a cor
 * da função (ver, pagar, responder), mensagem nova com marca âmbar, caixa sem tinta de linha cancelada. */
:root[data-visual="hubmed"] :is(.hm-guias, .hm-guias-canceladas, .hm-caixa-lista, .hm-contas-pagar, .hm-tela-mensagens, .hm-tela-logs) .hm-tabela .hm-row-action { opacity: 1; }
:root[data-visual="hubmed"] .hm-guias .op-acoes .ac-abrir { color: var(--accent); }
:root[data-visual="hubmed"] .hm-guias .op-acoes .ac-desligar { color: var(--danger); }
:root[data-visual="hubmed"] .hm-guias-tabela td.v-valor { font-weight: 700; color: var(--ink); }
:root[data-visual="hubmed"] :is(.hm-guias-canceladas, .hm-caixa-lista, .hm-tela-mensagens) .hm-row-action:is(.hm-row-action--ver, .hm-row-action--lida, .hm-row-action--responder) { color: var(--accent); }
:root[data-visual="hubmed"] .hm-contas-pagar .hm-row-action--pagar { color: var(--ok); }
:root[data-visual="hubmed"] .hm-contas-pagar .hm-row-action--pagar:hover:not(:disabled) { background: var(--ok-soft); color: var(--ok); }
:root[data-visual="hubmed"] :is(.hm-guias-canceladas, .hm-caixa-lista, .hm-tela-mensagens) .hm-row-action:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
:root[data-visual="hubmed"] .hm-caixa-lista tbody tr.is-cancelada,
:root[data-visual="hubmed"] .hm-caixa-lista tbody tr.is-cancelada td { background: transparent !important; }
:root[data-visual="hubmed"] .hm-tela-mensagens tbody tr.is-nova td:first-child { box-shadow: inset 3px 0 0 var(--warn); }

/* ---------- Passada de padrão visual (referência CRM Maringá, design/MARINGA-PARA-HUBMED.md, seção 11) ----------
 * Itens 1–5, 7–13. O item 6 (ações de linha com opacidade 0.45) não entra: as ações ficam visíveis e coloridas por função.
 * Cores de estado (verde, âmbar, vermelho), v-forte, v-valor e selos não mudam. */

/* Item 1: indicadores sem borda colorida e sem ciclo de cinco cores. O significado fica no número (recebido verde,
 * pendente âmbar, cancelado vermelho) e no ícone; navy, índigo e azul ficam em tinta normal. */
:root[data-visual="hubmed"] .hm-kpi,
:root[data-visual="hubmed"] .hm-kpi.is-destaque { border-left: 1px solid rgba(225,231,239,.8); }
:root[data-visual="hubmed"] .hm-kpi-valor,
:root[data-visual="hubmed"] .hm-dash-kpi-valor { color: var(--ink); }
:root[data-visual="hubmed"] .hm-kpi--verde :is(.hm-kpi-valor, .hm-dash-kpi-valor) { color: #047857; }
:root[data-visual="hubmed"] .hm-kpi--ambar :is(.hm-kpi-valor, .hm-dash-kpi-valor) { color: #8a5300; }
:root[data-visual="hubmed"] .hm-kpi--vermelho :is(.hm-kpi-valor, .hm-dash-kpi-valor) { color: #dc2626; }
:root[data-visual="hubmed"] .hm-kpi.is-vazio :is(.hm-kpi-valor, .hm-dash-kpi-valor) { color: #a1a1aa; }
:root[data-visual="hubmed"] .res-stat { border-left: 1px solid rgba(225,231,239,.8); }
:root[data-visual="hubmed"] .res-stat.is-atencao .res-stat-num { color: #8a5300; }
:root[data-visual="hubmed"] .res-stat.is-alerta .res-stat-num { color: #dc2626; }

/* Item 2: tabelas sem zebra e sem cabeçalho cinza. Linha fina separa as linhas; hover continua. */
:root[data-visual="hubmed"] :is(.table, .hm-tabela) th { background: transparent; border-bottom: 1px solid var(--line); }
:root[data-visual="hubmed"] :is(.table, .hm-tabela) tbody tr:not([aria-selected="true"]) { background: transparent; }
:root[data-visual="hubmed"] :is(.table, .hm-tabela) tbody tr:not([aria-selected="true"]) > td { border-bottom: 1px solid var(--line); }
:root[data-visual="hubmed"] :is(.table, .hm-tabela) tbody tr:not([aria-selected="true"]):hover { background: #f4f4f5; }

/* Item 3: cabeçalho de página mais leve. Título 17/700 e ícone em accent, sem moldura. */
:root[data-visual="hubmed"] .topbar-title { font-size: 17px; font-weight: 700; line-height: 22px; letter-spacing: 0; }
:root[data-visual="hubmed"] .hm-cab-icone { background: transparent; border: 0; box-shadow: none; color: var(--accent); }

/* Item 4: painel com a sombra suave do Maringá. */
:root[data-visual="hubmed"] .panel { box-shadow: 0 14px 36px rgba(16,50,48,.10); }

/* Item 7: botão de recolher sem círculo navy e sem sombra; fica como ícone no topo do menu. */
:root[data-visual="hubmed"] .hm-recolher { background: none; color: var(--ink-soft); border: 0; box-shadow: none; }
:root[data-visual="hubmed"] .hm-recolher:hover { background: var(--surface-muted); color: var(--ink); }

/* Item 8: peso máximo 800 em números; contagem e avatar em 700. */
:root[data-visual="hubmed"] .res-stat-num,
:root[data-visual="hubmed"] .hm-fila-principal b { font-weight: 800; }
:root[data-visual="hubmed"] .badge-count { font-weight: 700; }
:root[data-visual="hubmed"] .avatar { font-weight: 700; }

/* Item 9: fundo e sombra de modal e menu do Maringá. */
:root[data-visual="hubmed"] .modal-backdrop { background: rgba(4,12,15,.54); backdrop-filter: blur(5px); }
@media (min-width: 768px) { :root[data-visual="hubmed"] .modal-backdrop.is-lateral { background: rgba(15, 23, 42, 0.08); backdrop-filter: none; } }
:root[data-visual="hubmed"] .modal { box-shadow: 0 24px 70px rgba(0,0,0,.34); }
:root[data-visual="hubmed"] .menu { box-shadow: 0 14px 36px rgba(16,50,48,.14); }

/* Item 10: seleção sem anel duplo. A opção ativa tem fundo branco e borda fina. */
:root[data-visual="hubmed"] :is(.seg, .hm-segmento) button { border: 1px solid transparent; }
:root[data-visual="hubmed"] :is(.seg, .hm-segmento) button[aria-pressed="true"] { box-shadow: none; border-color: #e4e4e7; }

/* Item 11: números do atendimento em cartões com borda simples, sem grade de linhas de 1 px. */
:root[data-visual="hubmed"] .hm-atendimento-numeros { gap: var(--d2); background: none; padding: var(--d2); }
:root[data-visual="hubmed"] .hm-atendimento-numero { border: 1px solid var(--line) !important; border-radius: var(--r-cartao); }

/* Item 12: primeira coluna em 600 e cor normal. v-forte mantém o próprio peso. */
:root[data-visual="hubmed"] :is(.table, .hm-tabela) td:first-child:not(.v-forte) { font-weight: 600; color: #3f3f46; }

/* Item 13: rótulos de formas de pagamento e de dados do paciente sem caixa alta. */
:root[data-visual="hubmed"] .hm-formas span { text-transform: none; letter-spacing: 0; }
:root[data-visual="hubmed"] .hm-pac-dados dt { text-transform: none; letter-spacing: 0; font-weight: 600; }

/* Resumo da lista: valor em atenção com contraste suficiente sobre o fundo âmbar claro. */
:root[data-visual="hubmed"] .op-resumo .kpi.is-atencao .kpi-num { color: #8a5300; }

/* Resumo das listas (Orçamentos, Agenda) no celular igual ao de Guias: três colunas numa faixa só,
   valor em cima e rótulo embaixo, em vez de uma linha por número. */
@media (max-width: 767px) {
  :root[data-visual="hubmed"] .op-resumo { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 4px 8px; }
  :root[data-visual="hubmed"] .op-resumo .kpi { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; min-width: 0; padding: 2px 6px; }
  :root[data-visual="hubmed"] .op-resumo .kpi-num { font-size: 13px; white-space: nowrap; }
  :root[data-visual="hubmed"] .op-resumo .kpi-rot { font-size: 10px; white-space: normal; }
}

/* Pacientes: filtros e tabela numa superfície só. A barra é o cabeçalho da tabela: sem vão entre as duas,
 * cantos retos na emenda e uma divisória fina no lugar da borda dupla (vale em todas as larguras). */
:root[data-visual="hubmed"] .hm-tela[data-tela="pacientes"] .hm-tela-corpo { gap: 0; }
:root[data-visual="hubmed"] .hm-tela[data-tela="pacientes"] .hm-barra { border-radius: 12px 12px 0 0; border-bottom-color: var(--line); flex: none; }
:root[data-visual="hubmed"] .hm-tela[data-tela="pacientes"] .hm-tabela-cartao { border-top: 0; border-radius: 0 0 12px 12px; }
:root[data-visual="hubmed"] .hm-tela[data-tela="pacientes"] .hm-pac-rodape { margin-top: 8px; }
