/* Agenda, Pacientes e login da Oral Vitalli */
body[data-aba="agenda"] .barra-paciente,
body[data-aba="pacientes"] .barra-paciente,
body[data-aba="downloads"] .barra-paciente,
body[data-aba="agenda"] .topo-dentista,
body[data-aba="pacientes"] .topo-dentista { display: none; }

input[type="password"], input[type="email"], input[type="search"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d8e0ea;
  border-radius: 10px;
  font-size: 0.9rem;
  background: #fbfcfe;
  color: var(--text);
}

.painel { max-width: 1240px; margin: 20px auto 0; padding: 0 20px; }
.painel-barra { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.painel-barra .espaco { flex: 1; }
.painel-titulo { font-size: 1.02rem; font-weight: 700; color: var(--navy); }
.botao, .botao-claro, .botao-perigo {
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.botao { background: var(--accent); color: #fff; }
.botao:hover { filter: brightness(0.94); }
.botao-claro { background: #fff; color: var(--navy); box-shadow: inset 0 0 0 1px #d8e0ea; }
.botao-claro:hover { background: #f2f6fa; }
.botao-claro.ativo { background: var(--navy); color: #fff; box-shadow: none; }
.botao-perigo { background: var(--danger-bg); color: var(--danger); }
.botao[disabled], .botao-claro[disabled] { opacity: 0.55; cursor: default; }
.botao-whats { background: #16a34a; color: #fff; }
.grupo-botoes { display: inline-flex; gap: 4px; }
.pequeno { padding: 6px 10px; font-size: 0.78rem; }
.vazio { padding: 32px 12px; text-align: center; color: var(--muted); font-size: 0.9rem; }
.erro-campo { color: var(--danger); font-size: 0.82rem; font-weight: 600; min-height: 1.1em; margin-top: 8px; }

/* ---------- Grade da agenda ---------- */
.agenda-rolagem { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.agenda-grade { display: grid; min-width: 100%; }
.agenda-cab {
  position: sticky; top: 0; z-index: 3;
  background: #f7f9fc;
  border-bottom: 1px solid var(--line);
  padding: 10px 6px;
  font-size: 0.8rem; font-weight: 700; color: var(--navy);
  text-align: center;
}
.agenda-cab.hoje { color: var(--accent); }
.agenda-horas { position: relative; border-right: 1px solid var(--line); }
.agenda-hora {
  position: absolute; left: 0; right: 0;
  font-size: 0.7rem; color: var(--muted); text-align: right; padding-right: 6px; transform: translateY(-1px);
}
.agenda-coluna {
  position: relative;
  border-right: 1px solid var(--line);
  cursor: pointer;
  background-image: linear-gradient(to bottom, #e8edf3 1px, transparent 1px), linear-gradient(to bottom, #f4f6f9 1px, transparent 1px);
  background-size: 100% 48px, 100% 24px;
}
.agenda-coluna:last-child { border-right: none; }
.agenda-coluna:hover { background-color: #fbfdff; }
.agenda-agora { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 2; pointer-events: none; }
.bloco {
  position: absolute;
  border-radius: 8px;
  padding: 1px 6px;
  font-size: 0.72rem;
  line-height: 1.3;
  overflow: hidden;
  cursor: pointer;
  border-left: 4px solid;
  box-shadow: 0 1px 2px rgba(15,37,55,0.12);
  z-index: 1;
}
.bloco:hover { z-index: 2; filter: brightness(0.97); }
.bloco strong { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bloco span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bloco.st-agendada { background: #e0f2fe; border-color: #0284c7; color: #0c4a6e; }
.bloco.st-confirmada { background: #dcfce7; border-color: #16a34a; color: #14532d; }
.bloco.st-atendido { background: #e2e8f0; border-color: #64748b; color: #334155; }
.bloco.st-faltou { background: #fee2e2; border-color: #dc2626; color: #7f1d1d; }
.bloco.st-cancelada { background: #f1f5f9; border-color: #cbd5e1; color: #94a3b8; text-decoration: line-through; }
.bloco.tipo-bloqueio {
  border-color: #94a3b8; color: #475569;
  background: repeating-linear-gradient(45deg, #f1f5f9, #f1f5f9 6px, #e2e8f0 6px, #e2e8f0 12px);
}
.agenda-cab.clicavel { cursor: pointer; }
.agenda-cab.clicavel:hover { background: var(--accent-soft); }
.cor-dentista { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; box-shadow: inset 0 0 0 1px rgba(15,37,55,0.25); vertical-align: 0; }
.legenda { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.74rem; color: var(--muted); margin-top: 10px; }
.legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }
#legendaDentistas { font-weight: 600; color: var(--navy); }

/* ---------- Modal ---------- */
.modal-fundo {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15,37,55,0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: var(--radius);
  width: 100%; max-width: 560px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(15,37,55,0.3);
}
.modal.largo { max-width: 980px; }
.modal-cab { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.modal-cab h3 { font-size: 1rem; color: var(--navy); }
.modal-x { background: none; border: none; font-size: 1.3rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; }
.modal-rodape { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.modal-rodape .espaco { flex: 1; }
.campo { margin-bottom: 12px; }
.campos-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.campos-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .campos-2, .campos-3 { grid-template-columns: 1fr; gap: 0; } }

.busca-pac { position: relative; }
.busca-res {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 10;
  background: #fff; border-radius: 10px; margin-top: 4px;
  box-shadow: 0 8px 24px rgba(15,37,55,0.2);
  max-height: 220px; overflow-y: auto;
}
.busca-item { padding: 9px 12px; font-size: 0.85rem; cursor: pointer; border-bottom: 1px solid var(--line); }
.busca-item:last-child { border-bottom: none; }
.busca-item:hover { background: var(--accent-soft); }
.busca-item small { display: block; color: var(--muted); }
.pac-escolhido {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--accent-soft); border-radius: 10px; padding: 9px 12px; font-size: 0.86rem; font-weight: 600; color: var(--navy);
}
.alerta-alergia { background: var(--danger-bg); color: var(--danger); font-weight: 700; font-size: 0.82rem; border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; }

/* ---------- Listas e tabelas ---------- */
.tabela-caixa { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.tabela { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.tabela th { text-align: left; font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; padding: 11px 14px; background: #f7f9fc; white-space: nowrap; }
.tabela td { padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.tabela tr.clicavel { cursor: pointer; }
.tabela tr.clicavel:hover td { background: #f8fbfd; }
.tabela .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.etiqueta { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.et-verde { background: var(--success-bg); color: var(--success); }
.et-vermelho { background: var(--danger-bg); color: var(--danger); }
.et-azul { background: #e0f2fe; color: #0369a1; }
.et-cinza { background: #eef2f7; color: var(--muted); }

.resumo-fin { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
@media (max-width: 800px) { .resumo-fin { grid-template-columns: 1fr 1fr; } }
.resumo-item { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.resumo-item span { display: block; font-size: 0.74rem; font-weight: 600; color: var(--muted); }
.resumo-item strong { display: block; font-size: 1.2rem; color: var(--navy); margin-top: 4px; font-variant-numeric: tabular-nums; }
.resumo-item.verde strong { color: var(--success); }
.resumo-item.vermelho strong { color: var(--danger); }

.ficha-abas { display: flex; gap: 4px; background: #eef2f7; padding: 4px; border-radius: 12px; margin-bottom: 14px; overflow-x: auto; }
.ficha-abas button { flex: 1 0 auto; background: none; border: none; padding: 8px 12px; border-radius: 9px; font-size: 0.82rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.ficha-abas button.ativa { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(15,37,55,0.12); }
.evolucao { border-left: 3px solid var(--accent-line); padding: 6px 12px; margin-bottom: 12px; font-size: 0.86rem; white-space: pre-wrap; }
.evolucao small { display: block; color: var(--muted); margin-bottom: 3px; white-space: normal; }

/* ---------- Login ---------- */
.login-fundo {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: linear-gradient(150deg, #0f2537, #1b3a54 55%, #0e7490);
  overflow-y: auto;
}
.login-caixa { background: #fff; border-radius: 20px; width: 100%; max-width: 380px; padding: 28px 26px; box-shadow: 0 24px 60px rgba(0,0,0,0.35); }
.login-marca { text-align: center; margin-bottom: 18px; }
.login-marca img { height: 72px; object-fit: contain; }
.login-marca h2 { color: var(--navy); font-size: 1.15rem; margin-top: 6px; }
.login-marca p { color: var(--muted); font-size: 0.82rem; margin-top: 3px; }
.login-caixa .botao { width: 100%; padding: 12px; margin-top: 4px; }

.topo-conta { background: #eef2f7; border: none; border-radius: 10px; padding: 9px 12px; font-size: 0.8rem; font-weight: 600; color: var(--navy); cursor: pointer; white-space: nowrap; }
.aviso-offline { max-width: 1240px; margin: 12px auto 0; padding: 0 20px; font-size: 0.82rem; color: #92400e; }
.aviso-offline div { background: #fffbeb; border-radius: 10px; padding: 9px 14px; }

/* ---------- Ficha do paciente ---------- */
.alerta-pendente { background: #fffbeb; color: #92400e; font-weight: 600; font-size: 0.82rem; border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; cursor: pointer; }
.secao-form { font-size: 0.86rem; font-weight: 700; color: var(--navy); margin: 16px 0 10px; }
.plano-novo { display: grid; grid-template-columns: 1fr 2fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 14px; }
@media (max-width: 640px) { .plano-novo { grid-template-columns: 1fr 1fr; } .plano-novo .plano-proc { grid-column: 1 / -1; grid-row: 1; } }
.total-plano { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--navy); color: #cbd5e1; border-radius: 12px; padding: 12px 16px; margin-top: 12px; font-size: 0.82rem; font-weight: 700; }
.total-plano strong { color: #fff; font-size: 1.1rem; }
.linha-validade { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 0.82rem; color: var(--muted); }
.linha-validade label { margin: 0; }
.linha-validade input { width: 80px; }
.tabela select { padding: 6px 8px; font-size: 0.8rem; min-width: 110px; }

/* ---------- Odontograma ---------- */
.odonto-rolagem { overflow-x: auto; }
.odonto { min-width: 720px; background: #f7f9fc; border-radius: 12px; padding: 10px; }
.odonto.leite { min-width: 460px; max-width: 620px; margin: 0 auto; }
.arcada { display: grid; gap: 2px; }
.odonto-divisa { border-top: 2px solid #d8e0ea; margin: 8px 0; }
.dente { background: none; border: none; border-radius: 8px; padding: 2px; cursor: pointer; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.dente:hover { background: #e6f4f7; }
.dente.selecionado { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.dente svg { width: 100%; max-width: 38px; height: auto; display: block; }
.dente span { font-size: 0.72rem; font-weight: 700; color: var(--navy); padding: 2px 0; }
.marcas-dente { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.marca-dente { display: flex; align-items: center; gap: 5px; margin: 0; padding: 6px 10px; background: #fff; border-radius: 999px; font-size: 0.8rem; color: var(--text); cursor: pointer; box-shadow: inset 0 0 0 1px #d8e0ea; }
.marca-dente:has(input:checked) { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.marca-dente i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

#fichaImpressao { display: none; }

/* ---------- Pedido de exame ---------- */
.pedido { padding: 24px; }
.pedido-topo { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.pedido-limpar { background: none; border: none; color: var(--muted); font-size: 0.8rem; font-weight: 600; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.pedido-limpar:hover { background: #f1f5f9; color: var(--navy); }
.pedido-passo { display: flex; gap: 14px; padding-bottom: 22px; position: relative; }
.pedido-passo:last-child { padding-bottom: 0; }
.pedido-passo:not(:last-child)::before { content: ''; position: absolute; left: 13px; top: 32px; bottom: 4px; width: 2px; background: #eef2f7; }
.pedido-numero { flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 0.8rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.pedido-miolo { flex: 1; min-width: 0; }
.pedido-miolo h3 { font-size: 0.92rem; font-weight: 600; color: var(--navy); margin: 4px 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid #e2e8f0; background: #fff; color: #475569; border-radius: 999px; padding: 8px 14px; font-size: 0.82rem; font-weight: 500; cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.chip:hover { border-color: var(--accent-line); background: #f7fdfe; }
.chip.ativo { background: var(--accent); border-color: var(--accent); color: #fff; }
.pedido-obs { margin-top: 12px; border-color: #e8edf3; background: #fff; }
.pedido-dica { font-size: 0.82rem; color: var(--muted); margin-bottom: 10px; }
.exame-sugeridos { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.exame-item { display: flex; align-items: flex-start; gap: 11px; padding: 11px 13px; border-radius: 12px; background: #f8fafc; cursor: pointer; transition: background 0.15s, box-shadow 0.15s; user-select: none; }
.exame-item:hover { background: #f1f6fa; }
.exame-item.marcado { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent-line); }
.exame-item strong { display: block; font-size: 0.85rem; font-weight: 600; color: var(--navy); }
.exame-item small { display: block; font-size: 0.75rem; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.exame-marca { flex: 0 0 20px; height: 20px; border-radius: 50%; margin-top: 1px; box-shadow: inset 0 0 0 1.5px #cbd5e1; background: #fff; position: relative; }
.exame-item.marcado .exame-marca { background: var(--accent); box-shadow: none; }
.exame-item.marcado .exame-marca::after { content: ''; position: absolute; left: 7px; top: 3.5px; width: 4px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
#listaExames details summary { font-size: 0.82rem; font-weight: 600; color: var(--accent); cursor: pointer; padding: 4px 0; }
.exame-grupo { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.exame-grupo > span { font-size: 0.74rem; font-weight: 600; color: var(--muted); }
.pedido-opcao { background: #f8fafc; border-radius: 12px; padding: 11px 13px; font-size: 0.84rem; font-weight: 500; color: var(--text); }
.switch-suave { width: 40px !important; height: 22px !important; background: #cbd5e1; }
.switch-suave:checked { background: var(--accent); }

.exame-texto { flex: 1; min-width: 0; }
.exame-escolha { margin-top: 8px; cursor: default; }
.exame-seta { background: #fff; border: 1px solid var(--accent-line); border-radius: 9px; padding: 6px 10px; font-size: 0.8rem; font-weight: 600; color: var(--accent); cursor: pointer; }
.exame-seta.preenchida { background: var(--accent); border-color: var(--accent); color: #fff; }
.exame-seta .seta { font-size: 0.7rem; margin-left: 2px; }
.dentes-linha { margin-top: 8px; }
.dentes-linha > span { display: block; font-size: 0.7rem; color: var(--muted); margin-bottom: 3px; }
.dentes-grade { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; }
.dente-chip { border: 1px solid #dbe3ec; background: #fff; border-radius: 7px; padding: 6px 0; font-size: 0.74rem; font-weight: 600; color: #475569; cursor: pointer; min-width: 0; }
.dente-chip:hover { border-color: var(--accent); }
.dente-chip.ativo { background: var(--accent); border-color: var(--accent); color: #fff; }
.opcoes-linha { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.opcoes-linha .chip { padding: 6px 12px; font-size: 0.78rem; }

/* Passos numerados sozinhos: um passo escondido não deixa buraco */
.passos-contados { counter-reset: passo; }
.passos-contados .pedido-passo { counter-increment: passo; }
.passos-contados .pedido-numero::before { content: counter(passo); }
.passos-contados .pedido-passo:last-of-type { padding-bottom: 22px; }
.doc-opcoes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.doc-opcao { text-align: left; background: #f8fafc; border: 1.5px solid transparent; border-radius: 13px; padding: 12px 13px; cursor: pointer; }
.doc-opcao:hover { background: #f1f6fa; }
.doc-opcao.ativa { background: var(--accent-soft); border-color: var(--accent-line); }
.doc-opcao strong { display: block; font-size: 0.9rem; color: var(--navy); }
.doc-opcao span { display: block; font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.doc-datas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.doc-mais summary { font-size: 0.82rem; font-weight: 600; color: var(--accent); cursor: pointer; padding: 2px 0 10px; }

/* Tela de medicamentos */
.med-busca { margin-bottom: 10px; }
.med-livre { display: grid; gap: 8px; background: #f8fafc; border-radius: 13px; padding: 12px; margin-bottom: 14px; }
.med-livre-titulo { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.med-livre-linha { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 8px; }
.med-livre textarea { resize: vertical; }
.med-livre .btn { width: 100%; }
.med-livre-erro { font-size: 0.78rem; color: #dc2626; }
.med-livre-erro:empty { display: none; }
@media (max-width: 600px) { .med-livre-linha { grid-template-columns: 1fr; } }
.med-filtros { margin-bottom: 14px; }
.med-filtros .chip { padding: 6px 12px; font-size: 0.78rem; }
.med-escolhidos { display: flex; flex-wrap: wrap; gap: 6px; background: var(--accent-soft); border-radius: 13px; padding: 10px; margin-bottom: 14px; }
.med-tag { background: #fff; border: none; border-radius: 999px; padding: 6px 11px; font-size: 0.78rem; font-weight: 600; color: var(--navy); cursor: pointer; }
.med-tag span { color: var(--muted); margin-left: 3px; }
#listaMedicamentos .cat-header { text-transform: none; letter-spacing: 0; font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-bottom: 7px; }
#listaMedicamentos .cat-header > span:first-child::before { display: none; }
#listaMedicamentos .med-category { margin-bottom: 16px; }
#listaMedicamentos .med-grid { gap: 7px; }
#listaMedicamentos .med-item { border: none; background: #f8fafc; padding: 10px 11px; }
#listaMedicamentos .med-item:hover { background: #f1f6fa; transform: none; box-shadow: none; }
#listaMedicamentos .med-item.selected { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent-line); }
#listaMedicamentos .med-item .med-check:checked { background: var(--accent); border-color: var(--accent); }

/* ---------- Ficha do paciente ---------- */
.modal { border-radius: 20px; padding: 24px; }
.ficha-cab { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.ficha-avatar { flex: 0 0 52px; height: 52px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-soft), #dbeafe); color: var(--accent); font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; justify-content: center; }
.ficha-nome { flex: 1; min-width: 0; }
.ficha-nome h3 { font-size: 1.12rem; font-weight: 700; color: var(--navy); overflow-wrap: anywhere; }
.ficha-nome span { font-size: 0.8rem; color: var(--muted); }
.alerta-alergia, .alerta-pendente { font-weight: 600; }
.alerta-alergia { background: #fef2f2; border-radius: 12px; }
.alerta-pendente { background: #fffbeb; border-radius: 12px; }
.ficha-acoes { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 8px; scrollbar-width: none; }
.ficha-acoes button, .ficha-acoes a { flex: 0 0 auto; background: #f4f7fb; border: none; border-radius: 12px; padding: 9px 13px; font-size: 0.8rem; font-weight: 600; color: var(--navy); cursor: pointer; text-decoration: none; }
.ficha-acoes button:hover, .ficha-acoes a:hover { background: var(--accent-soft); }
.ficha-abas { background: none; border-bottom: 1px solid var(--line); border-radius: 0; padding: 0; gap: 0; scrollbar-width: none; }
.ficha-abas button { flex: 0 0 auto; border-radius: 0; padding: 10px 12px; margin-bottom: -1px; border-bottom: 2px solid transparent; font-weight: 500; }
.ficha-abas button.ativa { background: none; box-shadow: none; color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.ficha-corpo { min-height: 240px; }
.ficha-cartoes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.ficha-cartao { text-align: left; background: #f8fafc; border: none; border-radius: 14px; padding: 13px 14px; cursor: pointer; transition: background 0.15s; }
.ficha-cartao:hover { background: var(--accent-soft); }
.ficha-cartao span { display: block; font-size: 0.72rem; color: var(--muted); }
.ficha-cartao strong { display: block; font-size: 0.98rem; font-weight: 700; color: var(--navy); margin-top: 3px; }
.ficha-dados { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; font-size: 0.86rem; color: var(--text); }
.ficha-dados span { display: block; font-size: 0.72rem; color: var(--muted); margin-bottom: 1px; }
.ficha-editar { background: none; border: none; color: var(--accent); font-size: 0.82rem; font-weight: 600; cursor: pointer; padding: 12px 0 0; }
.ficha-rodape { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.ficha-rodape select { width: auto; padding: 6px 8px; font-size: 0.8rem; }
.modal .anamnese-row { background: #f8fafc; border: none; border-radius: 12px; }
.modal .caixa-cinza { border-radius: 14px; }
@media (max-width: 640px) {
  .pedido { padding: 16px; }
  .doc-datas { grid-template-columns: 1fr; }
  .dente-chip { padding: 8px 0; }
  .pedido-numero { flex-basis: 24px; height: 24px; font-size: 0.74rem; }
  .pedido-passo { gap: 10px; }
  .pedido-passo:not(:last-child)::before { left: 11px; }
  .ficha-cartoes { grid-template-columns: 1fr 1fr; }
  .ficha-dados { grid-template-columns: 1fr; }
  .ficha-rodape select { flex: 1; min-width: 0; }
}

/* ---------- Celular ---------- */
@media (max-width: 640px) {
  .topo { position: static; }
  .topo-linha { padding: 8px 10px; gap: 8px; }
  .topo-marca img { height: 32px; width: 32px; }
  .topo-marca span { display: none; }
  .aba-btn { padding: 8px 10px; font-size: 0.8rem; }
  .painel { margin-top: 10px; padding: 0 8px; }
  .painel-barra { gap: 6px; margin-bottom: 8px; }
  .painel-barra .espaco { display: none; }
  #agendaBarra .painel-titulo { order: -2; flex: 1 1 0; min-width: 0; font-size: 0.86rem; }
  #agendaBarra .painel-titulo::first-letter { text-transform: uppercase; }
  #agendaBarra input[type="date"] { order: -1; flex: 0 0 150px; padding: 6px 8px; }
  #agendaBarra select { flex: 1 1 90px; min-width: 0; padding: 6px 8px; }
  #agendaBarra > .botao, #agendaBarra > .botao-claro { flex: 1; }
  #agendaBarra .botao, #agendaBarra .botao-claro { padding: 8px 10px; font-size: 0.8rem; }
  .agenda-rolagem { border-radius: 10px; }
  .agenda-cab { padding: 6px 2px; font-size: 0.74rem; }
  .agenda-horas { position: sticky; left: 0; z-index: 2; background: #fff; }
  .agenda-hora { padding-right: 3px; font-size: 0.64rem; }
  .bloco { padding: 1px 4px; font-size: 0.68rem; }
  .bloco .cor-dentista { width: 7px; height: 7px; margin-right: 2px; }
  .legenda { gap: 8px; font-size: 0.68rem; margin-top: 8px; }
  .modal-fundo { padding: 0; }
  .modal { max-width: none; min-height: 100dvh; border-radius: 0; padding: 14px 12px; }
  .modal.largo { max-width: none; }
  /* 16px impede o celular de dar zoom ao tocar no campo */
  input, select, textarea { font-size: 16px !important; }
  .tabela th, .tabela td { padding: 8px 10px; }
}

@media print {
  body.imprimindo-ficha > *:not(#fichaImpressao) { display: none !important; }
  body.imprimindo-ficha #fichaImpressao { display: block; }
  .painel, .modal-fundo, .login-fundo, .aviso-offline { display: none !important; }
}

/* Com sete abas, em tela estreita a primeira não pode ficar cortada */
.abas { justify-content: safe center; }
.aba-btn { padding: 9px 12px; }

/* No celular, nenhum conteúdo pode alargar a página */
.container > .left-col, .container > .right-col { min-width: 0; }
.doc-opcoes, .doc-datas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.doc-datas input, #abaAtestado select { min-width: 0; max-width: 100%; }
@media (max-width: 640px) {
  .container { grid-template-columns: minmax(0, 1fr); }
  .doc-datas { grid-template-columns: minmax(0, 1fr); }
}

/* Procedimentos do dente: nome, valor e remover na mesma linha, também no celular */
.od-linha { display: grid; grid-template-columns: minmax(0, 1fr) 112px 30px; gap: 6px; align-items: center; margin-bottom: 8px; }
.od-linha .modal-x { padding: 4px; font-size: 1rem; }
@media (max-width: 640px) {
  .od-linha { grid-template-columns: minmax(0, 1fr) 96px 26px; }
  .modal-rodape .botao, .modal-rodape .botao-claro { flex: 1; }
}

/* Pedido de acesso de dentista */
.login-caixa { max-height: calc(100dvh - 32px); overflow-y: auto; }
.login-link { display: block; width: 100%; background: none; border: none; color: var(--accent); font-size: 0.82rem; font-weight: 600; cursor: pointer; padding: 12px 0 0; }
.login-aviso { font-size: 0.88rem; line-height: 1.5; color: var(--text); text-align: center; }
.login-duplo { display: grid; gap: 8px; }
.pedidos-acesso { display: flex; flex-direction: column; gap: 8px; }
.pedido-acesso { background: #fffbeb; border-radius: 14px; padding: 12px 14px; font-size: 0.84rem; }
.pedido-acesso strong { display: block; color: var(--navy); font-size: 0.92rem; }
.pedido-acesso > span { display: block; color: var(--muted); font-size: 0.8rem; overflow-wrap: anywhere; }
.pedido-botoes { display: flex; justify-content: flex-end; gap: 6px; }

/* Dentista logado: documentos só em nome dele */
body.dentista-fixo .topo-dentista { display: none; }

/* Dia em lista única: paciente e procedimento na mesma linha */
.bloco-linha { display: flex; align-items: baseline; gap: 8px; }
.bloco-linha strong { flex: 0 1 auto; min-width: 0; }
.bloco-linha span { flex: 1; min-width: 0; opacity: 0.8; }

/* Radiografias na ficha */
.rx-novo { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: end; margin-bottom: 8px; }
.rx-novo label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 4px; }
.rx-novo input, .rx-novo select { width: 100%; min-width: 0; }
.rx-arquivo { grid-column: span 2; }
.rx-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.rx-item { background: #f8fafc; border: none; border-radius: 12px; padding: 6px; cursor: pointer; text-align: left; min-width: 0; }
.rx-item img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: #0f2537; }
.rx-item span { display: block; font-size: 0.74rem; color: var(--muted); padding: 6px 4px 2px; overflow-wrap: anywhere; }
.rx-topo { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 0.82rem; color: var(--muted); }
.rx-imagem { background: #0f2537; border-radius: 12px; overflow: auto; max-height: 60vh; text-align: center; }
.rx-imagem img { display: block; margin: 0 auto; max-width: 100%; max-height: 60vh; cursor: zoom-in; }
.rx-imagem img.ampliada { max-width: none; max-height: none; cursor: zoom-out; }
@media (max-width: 600px) {
  .rx-novo { grid-template-columns: minmax(0, 1fr); }
  .rx-arquivo { grid-column: auto; }
}

/* Cor do profissional */
.pedido-cor { margin: 8px 0; }
.pedido-cor input[type="color"], .usuario-prof input[type="color"] { width: 64px; height: 42px; padding: 3px; cursor: pointer; }
.usuario-prof { margin-top: 10px; }
.usuario-prof[hidden] { display: none; }

/* Arrastar consulta */
.bloco { cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.bloco.st-atendido, .bloco.st-faltou, .bloco.st-cancelada { cursor: pointer; }
.bloco.arrastando { z-index: 30; cursor: grabbing; opacity: 0.85; box-shadow: 0 6px 16px rgba(15, 37, 55, 0.3); }
.arraste-rotulo { position: absolute; z-index: 31; right: 4px; transform: translateY(-100%); padding: 1px 6px; border-radius: 6px; background: var(--navy); color: #fff; font-size: 0.7rem; font-weight: 600; pointer-events: none; }

/* Plano: valor na lista e aprovar vários */
.plano-aprovar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.plano-todos { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--muted); cursor: pointer; }
.plano-todos input, .pl-marca { width: 18px; height: 18px; margin: 0; cursor: pointer; }
.tabela input.plano-valor { width: 96px; padding: 6px 8px; font-size: 0.85rem; text-align: right; }

/* Configurações da clínica */
.cfg-logo { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cfg-logo img { width: 72px; height: 72px; object-fit: contain; background: #f8fafc; border-radius: 12px; padding: 6px; }
.cfg-logo > div { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cfg-logo label.botao-claro { cursor: pointer; }
.cfg-logo .pedido-dica { width: 100%; margin: 0; }

/* Cadeira na visão da semana (com mais de uma cadeira) */
.tag-cadeira { font-style: normal; font-size: .68rem; font-weight: 700; background: rgba(0,0,0,.12); border-radius: 4px; padding: 0 4px; margin-right: 4px; }

.boas-vindas-clinica {
  width: min(92vw, 500px);
  max-height: 90dvh;
  border: 0;
  border-radius: 20px;
  background: #fff;
  color: var(--navy);
  padding: 0;
  overflow: auto;
  box-shadow: 0 22px 72px rgba(14, 59, 67, .28);
}
.boas-vindas-clinica::backdrop { background: rgba(16, 35, 49, .6); }
.boas-vindas-marca { display: grid; place-items: center; padding: 24px; background: #edf7f5; }
.boas-vindas-marca img { display: block; object-fit: contain; }
.boas-vindas-conteudo { padding: clamp(18px, 5vw, 30px); }
.boas-vindas-conteudo h2 { margin: 0 0 .6rem; font-size: clamp(1.32rem, 5vw, 1.7rem); }
#boasVindasTexto { margin: 0; line-height: 1.55; color: var(--muted); }
#boasVindasErro:empty { display: none; }
.boas-vindas-acoes { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; }

.guia-numero { margin: 0 0 14px; color: var(--muted); font-size: .85rem; font-weight: 600; }
.guia-documento { display: grid; grid-template-columns: auto 1fr; gap: 12px; margin-bottom: 16px; }
.guia-documento > :last-child { grid-column: 1 / -1; }
.guia-documento img, .guia-conclusao img, .receita-emitida-logo { object-fit: contain; }
.guia-conclusao { display: grid; justify-items: center; gap: 8px; text-align: center; }
.receita-emitida-logo { display: block; margin-bottom: 16px; }

#gestorConteudo h2 { margin-top: 0; }
#gestorConteudo [data-gestor-secao] { margin-top: 20px; }
#gestorConteudo [aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.gestor-assinatura { margin-bottom: 12px; }
.gestor-mensagem { white-space: pre-wrap; overflow-wrap: anywhere; }
.gestor-status:empty { display: none; }

.calendario-assinatura { margin: 12px 0; }
.calendario-assinatura summary { cursor: pointer; padding-block: 6px; }
.calendario-assinatura ul { list-style: none; padding: 0; margin: 8px 0; }
.calendario-assinatura li { padding: 7px 0; border-bottom: 1px solid rgba(15, 37, 55, .12); }
.calendario-assinatura li { display: flex; justify-content: space-between; gap: 12px; }
#botaoMinhaAssinatura[hidden] { display: none !important; }

.login-caminhos { display: grid; gap: 8px; text-align: center; margin-top: 12px; }
.agenda-lista-dia { display: grid; gap: 10px; list-style: none; padding: 0; margin: 0; }
.agenda-lista-dia li { display: grid; gap: 6px; padding: 12px; background: white; border: 1px solid #d6e4e6; border-radius: 10px; }

/* Ficha e orçamento em papel */
@page ficha-arcada { size: A4 portrait; margin: 14mm 16mm; }
.ficha-papel { page: ficha-arcada; color: #173342; font-size: 10pt; line-height: 1.4; overflow-wrap: anywhere; }
.ficha-papel-cab { display: flex; justify-content: space-between; align-items: center; gap: 8mm; border-bottom: 2px solid #23736e; padding-bottom: 4mm; break-inside: avoid; }
.ficha-papel-marca { display: flex; align-items: center; gap: 4mm; }
.ficha-papel-marca img { width: 22mm; height: 16mm; object-fit: contain; }
.ficha-papel-marca strong { font-size: 14pt; }
.ficha-papel-marca span, .ficha-papel-data span { display: block; color: #4c6370; font-size: 9pt; }
.ficha-papel-data { text-align: right; white-space: nowrap; }
.ficha-papel h1 { margin: 7mm 0 3mm; font-size: 25pt; line-height: 1.06; letter-spacing: -.5pt; break-after: avoid; }
.ficha-papel h2 { margin: 0 0 2.5mm; font-size: 13pt; color: #154c4e; break-after: avoid; }
.ficha-papel p { margin: 0 0 1.5mm; white-space: pre-line; }
.ficha-papel-dados { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5mm 6mm; margin: 0 0 6mm; padding: 3mm 4mm; border: 1px solid #c9d8db; background: #f3f8f8; break-inside: avoid; }
.ficha-papel-dados dt, .ficha-papel-total span { color: #405c64; font-size: 8.5pt; }
.ficha-papel-dados dd { margin: .5mm 0 0; font-weight: 650; }
.ficha-papel-bloco { margin-bottom: 5mm; }
.ficha-papel table { width: 100%; border-collapse: collapse; }
.ficha-papel thead { display: table-header-group; }
.ficha-papel tr { break-inside: avoid; }
.ficha-papel th, .ficha-papel td { border-bottom: 1px solid #d3dfe1; padding: 2.3mm 2.5mm; text-align: left; vertical-align: top; }
.ficha-papel th { background: #deeeeb; color: #174a48; font-size: 9pt; }
.ficha-papel th:first-child, .ficha-papel td:first-child { width: 23%; }
.ficha-papel th:last-child, .ficha-papel td:last-child { text-align: right; white-space: nowrap; }
.ficha-papel td:last-child { font-variant-numeric: tabular-nums; }
.ficha-papel-total { display: flex; justify-content: space-between; gap: 5mm; margin-top: 4mm; padding: 3mm 4mm; border: 1px solid #6b9994; background: #e7f3f0; break-inside: avoid; }
.ficha-papel-total > :last-child { text-align: right; }
.ficha-papel-total strong { display: block; }
.ficha-papel-total > :last-child strong { font-size: 16pt; }
.ficha-papel-rodape { margin-top: 3mm; text-align: center; color: #4c6370; break-inside: avoid; }
@media screen {
  body.imprimindo-ficha { overflow: hidden; }
  body.imprimindo-ficha #fichaImpressao { display: block; position: fixed; inset: 0; z-index: 1000; overflow: auto; background: #edf3f3; }
  .ficha-previa-acoes { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; padding: 12px; background: white; border-bottom: 1px solid #c9d8db; }
  .ficha-previa-acoes p { flex-basis: 100%; text-align: center; margin: 0; font-size: .85rem; }
  .ficha-papel { width: min(100% - 24px, 210mm); margin: 16px auto 32px; padding: clamp(12px, 4vw, 16mm); background: white; }
  .ficha-papel h1 { font-size: clamp(19px, 4vw, 33px); }
}
@media print {
  .ficha-previa-acoes { display: none !important; }
}

/* Documentos clínicos emitidos */
.documento-papel-titulo { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2mm 5mm; margin: 7mm 0 4mm; }
.documento-papel-titulo h1 { margin: 0; }
.documento-papel-via { align-self: flex-start; padding: 1mm 2.5mm; border: 1px solid #80a8a3; border-radius: 2mm; color: #174a48; font-weight: 700; font-size: 9pt; }
.documento-papel-alerta { border-left: 2px solid #8e5139; padding: 1.5mm 3mm; color: #6e3825; }
.documento-papel-conteudo { margin-top: 6mm; }
.documento-papel-conteudo h2 { padding: 0 0 2mm; border-bottom: 1px solid #c9d8db; }
.documento-papel-texto { white-space: pre-wrap; font-size: 11pt; line-height: 1.55; }
.documento-papel .documento-papel-cid { margin-top: 3mm; }
.documento-papel-rodape { margin-top: 11mm; break-inside: avoid; page-break-inside: avoid; }
.documento-papel-rodape > p { color: #4c6370; text-align: center; }
.documento-papel-assinatura { width: min(100%, 88mm); margin: 10mm auto 4mm; padding-top: 2mm; border-top: 1px solid #547078; text-align: center; }
.documento-papel-assinatura strong, .documento-papel-assinatura span { display: block; }
.documento-papel-referencia { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2mm; border-top: 1px solid #d3dfe1; padding-top: 2mm; font-size: 8.5pt; color: #4c6370; }
#receitaImpressao .documento-papel {
  width: 100%;
  margin: 0;
  padding: .1mm 0;
}
@media screen {
  #receitaImpressao.medindo-documento {
    display: block;
    position: fixed;
    top: 0;
    left: -10000px;
    width: 178mm;
    visibility: hidden;
    pointer-events: none;
  }
  #receitaImpressao .documento-papel h1 { font-size: 25pt; }
}
.documento-papel[data-formato] .documento-papel-texto { font-size: 10pt; line-height: 1.35; }
.documento-papel[data-formato] .documento-papel-titulo { margin: 4mm 0 3mm; }
.documento-papel[data-formato] .ficha-papel-dados { margin-bottom: 3mm; }
.documento-papel[data-formato] .documento-papel-conteudo { margin-top: 3mm; }
.documento-papel[data-formato] .documento-papel-rodape { margin-top: 6mm; }
.documento-papel[data-formato] .documento-papel-assinatura { margin-top: 7mm; }
.documento-papel[data-formato="reduzido"] .documento-papel-texto { font-size: 9pt; line-height: 1.25; }
.documento-papel[data-formato="minimo"] .documento-papel-texto { font-size: 8pt; line-height: 1.15; }
@media print {
  body.imprimindo-receita-emitida { min-height: 0; margin: 0; }
  body.imprimindo-receita-emitida #receitaImpressao { page: ficha-arcada; }
  .documento-papel + .documento-papel { break-before: page; }
}

/* Navegação da clínica e seleção de procedimentos */
.conta-identidade { display: grid; gap: 2px; padding: 13px 15px; margin-bottom: 14px; border-radius: 12px; background: #eaf4f2; }
.conta-identidade span { font-size: .86rem; color: var(--muted); }
.conta-grupos { display: grid; gap: 8px; }
.conta-grupo, .procedimentos-painel { border: 1px solid #d6e4e6; border-radius: 12px; background: #fff; padding: 10px 12px; min-width: 0; }
.conta-grupo summary, .procedimentos-painel summary, #odBocaToda summary { cursor: pointer; font-weight: 650; padding: 5px 0; }
.conta-opcoes { display: grid; gap: 7px; padding-top: 8px; }
.conta-opcoes .botao-claro { text-align: left; width: 100%; text-decoration: none; }
.conta-grupo[open] > .conta-opcoes, .procedimentos-painel[open] > :not(summary), .clinica-troca, #odBocaToda[open] form { animation: clinica-conteudo 170ms ease-out both; }
@keyframes clinica-conteudo { from { opacity: .68; transform: translateY(4px); } }
.ficha-subabas { margin-top: -10px; }
.procedimentos-painel { width: 100%; margin: 6px 0; }
.procedimentos-painel .campo { margin-top: 8px; }
.procedimentos-painel input { width: 100%; min-width: 0; }
.procedimentos-lista { max-height: min(40vh, 350px); overflow: auto; overscroll-behavior: contain; }
.procedimentos-grupo h4 { padding: 9px 10px 4px; font-size: .81rem; color: var(--muted); }
.procedimento-opcao { display: flex; gap: 12px; justify-content: space-between; align-items: center; width: 100%; min-height: 42px; text-align: left; border: 0; border-bottom: 1px solid #eaf0f0; background: #fff; color: var(--text); padding: 8px 10px; cursor: pointer; font: inherit; }
.procedimento-opcao:hover, .procedimento-opcao:focus-visible { background: #eaf4f2; }
.procedimento-opcao strong { flex-shrink: 0; color: #205c58; font-size: .86rem; }
.procedimentos-painel [hidden] { display: none !important; }
.procedimentos-vazio { padding: 12px; }
.plano-novo .procedimentos-painel { grid-column: 1 / -1; }
.od-linha .od-proc, .od-linha .od-valor { min-width: 0; width: 100%; }
#agendaBarra { display: grid; gap: 8px; }
.agenda-controle { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.agenda-controle .painel-titulo { margin-left: auto; }
.agenda-filtros-controle select { max-width: 100%; }
#agendaGrade[aria-busy=true] { opacity: .77; }
.documento-acoes { flex-wrap: wrap; gap: 8px; }
.receita-dialog::backdrop { background: rgba(15,37,55,.45); }
.receita-dialog[open] { animation: clinica-conteudo 170ms ease-out both; }
@media (max-width: 640px) {
  .agenda-controle .painel-titulo { margin-left: 0; flex-basis: 100%; }
  .agenda-acoes-controle .botao { flex: 1; }
  .od-linha { grid-template-columns: minmax(0, 1fr) 36px; }
  .od-linha .od-proc { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  .conta-grupo[open] > .conta-opcoes, .procedimentos-painel[open] > :not(summary), .clinica-troca, #odBocaToda[open] form, .receita-dialog[open] { animation: none; }
}
#odBocaToda select, #odBocaToda input { width: 100%; min-height: 42px; }

.procedimentos-subgrupo { margin: 0 6px 7px; }
.procedimentos-subtitulo { padding: 6px 5px; font-size: .82rem; color: #285e59; font-weight: 650; background: #eff6f4; }
#catalogoLista .procedimentos-grupo { margin-top: 14px; }
.catalogo-preco-linha { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 5px; border-bottom: 1px solid #e5eeec; }
.catalogo-preco-linha > strong { flex: 1 1 185px; }

.recibo-papel { display: flex; flex-direction: column; }
.recibo-papel .recibo-declaracao { margin-bottom: 6mm; font-size: 11pt; }
.recibo-tratamento ul { list-style: none; padding: 0; margin: 0; }
.recibo-tratamento li { border-top: 1px solid #d3dfe1; padding: 2.5mm 0; break-inside: avoid; }
.recibo-papel .ficha-papel-rodape { margin-top: auto; padding-top: 12mm; }
@media screen {
  .recibo-papel { box-sizing: border-box; min-height: 297mm; }
}
@media print {
  .recibo-papel { min-height: 255mm; }
}
