/* Odontograma: dictado inteligente (micrófono grande) y herramientas en fichas de 3 columnas */
html body #odontogramaModal .odonto-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html body #odontogramaModal .odonto-wave { display: none; }
html body #odontogramaModal .odonto-ai-lb { display: none; }

/* Celular e iPad vertical: el micrófono vive en la barra Odi debajo del desplegable (sin duplicarlo en el encabezado) */
@media (max-width: 834px) {
  html body #odontogramaModal .odonto-mic-hd { display: none !important; }
}

@media (min-width: 835px) {
  html body #odontogramaModal .odonto-mic-hd { display: none !important; }
  html body #odontogramaModal .odonto-body { grid-template-columns: 276px minmax(0, 1fr) !important; }

  /* Barra de dictado */
  html body #odontogramaModal .odonto-main > .odonto-ai-box, html body #odontogramaModal .odonto-main > .odonto-ai-box.ai-open { padding: 10px 16px 4px !important; border-bottom: 0; gap: 2px 8px; }
  html body #odontogramaModal .odonto-main > .odonto-ai-box > .odonto-ai-input-row { flex: 1 1 100%; height: 54px; padding: 0 8px !important; gap: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: 0 1px 2px rgba(15, 23, 42, .04); transition: border-color .2s, background .2s; }
  html body #odontogramaModal .odonto-ai-box.mic-on > .odonto-ai-input-row { border-color: rgba(220, 38, 38, .35); background: linear-gradient(90deg, #fff5f5, var(--card) 60%); }
  html body #odontogramaModal .odonto-mic-big { flex: none; width: 40px; height: 40px; min-height: 40px; padding: 0; margin: 0; border: 0; border-radius: 50%; display: grid !important; place-items: center; background: var(--accent-soft); color: var(--accent-strong); box-shadow: 0 0 0 1px rgba(2, 132, 199, .28); cursor: pointer; transition: background .2s, box-shadow .2s; }
  html body #odontogramaModal .odonto-mic-big i, html body #odontogramaModal .odonto-mic-big svg { width: 19px; height: 19px; }
  html body #odontogramaModal .odonto-mic-big:hover { background: #e0f2fe; }
  html body #odontogramaModal .odonto-mic-big.listening { background: linear-gradient(145deg, #ef4444, #dc2626) !important; color: #fff !important; border: 0 !important; box-shadow: 0 0 0 4px rgba(220, 38, 38, .16), 0 0 0 9px rgba(220, 38, 38, .07), 0 6px 14px -4px rgba(220, 38, 38, .55); animation: odontoMicRing 1.6s ease-in-out infinite; }
  html body #odontogramaModal .odonto-ai-field { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
  html body #odontogramaModal .odonto-ai-lb { display: flex; align-items: center; gap: 6px; font-size: .68rem; font-weight: 800; letter-spacing: .02em; color: var(--accent-strong); }
  html body #odontogramaModal .odonto-ai-lb::before { content: "Dictado inteligente \00b7 toca el micrófono y habla"; }
  html body #odontogramaModal .odonto-ai-box.mic-on .odonto-ai-lb { color: var(--red); }
  html body #odontogramaModal .odonto-ai-box.mic-on .odonto-ai-lb::before { content: "Escuchando \00b7 marca solo lo que dices"; }
  html body #odontogramaModal .odonto-ai-box.mic-on .odonto-ai-lb::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--red); order: -1; }
  html body #odontogramaModal .odonto-main > .odonto-ai-box .odonto-ai-textarea { height: 22px !important; min-height: 22px !important; max-height: 22px; padding: 0; border: 0; background: transparent; box-shadow: none; outline: 0; font-size: .86rem; font-weight: 600; line-height: 22px; }
  html body #odontogramaModal .odonto-ai-box.mic-on .odonto-ai-textarea { color: var(--ink); }
  html body #odontogramaModal .odonto-ai-box.mic-on .odonto-wave { display: inline-flex; align-items: center; gap: 3px; height: 28px; margin-right: 2px; }
  html body #odontogramaModal .odonto-wave i { width: 3px; border-radius: 2px; background: var(--red); opacity: .85; animation: odontoWave 1s ease-in-out infinite; }
  html body #odontogramaModal .odonto-wave i:nth-child(1) { height: 8px; animation-delay: -.1s; }
  html body #odontogramaModal .odonto-wave i:nth-child(2) { height: 16px; animation-delay: -.3s; }
  html body #odontogramaModal .odonto-wave i:nth-child(3) { height: 24px; animation-delay: -.5s; }
  html body #odontogramaModal .odonto-wave i:nth-child(4) { height: 12px; animation-delay: -.7s; }
  html body #odontogramaModal .odonto-wave i:nth-child(5) { height: 22px; animation-delay: -.2s; }
  html body #odontogramaModal .odonto-wave i:nth-child(6) { height: 14px; animation-delay: -.6s; }
  html body #odontogramaModal .odonto-wave i:nth-child(7) { height: 7px; animation-delay: -.4s; }
  html body #odontogramaModal .odonto-main > .odonto-ai-box .odonto-ai-btn { height: 38px !important; min-height: 38px; border-radius: 12px; padding: 0 16px; }
  /* Auto-completar / Restablecer: enlaces discretos, el aviso verde a la derecha */
  html body #odontogramaModal .odonto-main > .odonto-ai-box > .odonto-ai-actions { flex: 1 1 100%; gap: 2px; }
  html body #odontogramaModal .odonto-main > .odonto-ai-box .odonto-ai-actions .odonto-mini-btn { height: 30px; min-height: 30px; padding: 0 8px; border: 0; background: transparent; box-shadow: none; color: var(--muted); font-size: .75rem; font-weight: 600; border-radius: 9px; }
  html body #odontogramaModal .odonto-main > .odonto-ai-box .odonto-ai-actions .odonto-mini-btn:hover { background: var(--card-2); }
  html body #odontogramaModal .odonto-main > .odonto-ai-box #odontoAiFeedback { flex: 1 1 auto; margin: 0 0 0 auto; text-align: right; }

  /* Herramientas: fichas de 3 columnas (símbolo arriba, nombre abajo) */
  html body #odontogramaModal .odonto-side { padding: 10px 12px 8px; gap: 4px; overflow-x: hidden; }
  html body #odontogramaModal .odonto-g { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px !important; margin: 0 0 2px !important; }
  html body #odontogramaModal .odonto-g > .odonto-grp { margin: 6px 2px 0 !important; font-size: .66rem !important; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
  html body #odontogramaModal .odonto-tool-chip { flex-direction: column; justify-content: center; align-items: center; text-align: center; min-height: 46px !important; height: 46px; padding: 0 3px !important; gap: 4px; font-size: .68rem !important; line-height: 1.08; border-radius: 10px; }
  html body #odontogramaModal .odonto-tool-chip .tool-dot { width: 11px !important; height: 11px !important; }
}

/* Escritorio: encabezado en una línea y pie con estadísticas + dentición en una sola fila */
@media (min-width: 835px) {
  html body #odontogramaModal .odonto-header { padding: 10px 16px; }
  html body #odontogramaModal .odonto-header-title { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; min-width: 0; }
  html body #odontogramaModal .odonto-header-title h3 { font-size: 1rem; font-weight: 800; letter-spacing: -.01em; margin: 0; white-space: nowrap; }
  html body #odontogramaModal .odonto-header-title p { margin: 0; font-size: .75rem; color: var(--muted); white-space: nowrap; }
  html body #odontogramaModal .odonto-header-actions button { height: 34px; min-height: 34px; padding: 0 12px; font-size: .78rem; border-radius: 10px; gap: 6px; }
  html body #odontogramaModal .odonto-header-actions button[onclick^="closeOdontogramaModal"] { width: 34px; min-width: 34px; flex: none; padding: 0; justify-content: center; }
  html body #odontogramaModal .odonto-cerrar-lb { display: none; }
  html body #odontogramaModal .odonto-footer { display: flex !important; align-items: center; flex-wrap: wrap; gap: 8px 14px; padding: 8px 16px !important; }
  html body #odontogramaModal .odonto-footer > .odonto-stats-row { flex: 1 1 auto; margin: 0; }
  html body #odontogramaModal .odonto-footer > .odonto-temp-row { flex: none; margin-left: auto; flex-wrap: nowrap; padding: 0 !important; border: 0 !important; gap: 10px; }
  html body #odontogramaModal .odonto-footer > .odonto-temp-row .odonto-temp-hint { display: none; }
  html body #odontogramaModal .odonto-footer > div:last-child { display: none; }
}
@keyframes odontoWave { 0%, 100% { transform: scaleY(.45); } 50% { transform: scaleY(1); } }
@keyframes odontoMicRing { 50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, .2), 0 0 0 13px rgba(220, 38, 38, .06), 0 6px 14px -4px rgba(220, 38, 38, .55); } }
@media (prefers-reduced-motion: reduce) { html body #odontogramaModal .odonto-wave i, html body #odontogramaModal .odonto-mic-big.listening { animation: none; } }

/* Una sola línea para la ayuda del modo */
html body #odontogramaModal .odonto-modo-hint { white-space: nowrap; font-size: .66rem; margin-left: 2px; margin-right: 0; }

/* Modo oscuro */
:root[data-theme="dark"] #odontogramaModal { --om-fill: #252528; --om-rojo: #f87171; --om-rojo-bg: rgba(248, 113, 113, .14); --om-azul: #60a5fa; --om-azul-bg: rgba(96, 165, 250, .16); }
:root[data-theme="dark"] html body #odontogramaModal .odonto-modo .om-thumb, html[data-theme="dark"] body #odontogramaModal .odonto-modo .om-thumb { background: #3a3a3f; box-shadow: none; }
html[data-theme="dark"] body #odontogramaModal .odonto-tool-chip { color: var(--ink); }
html[data-theme="dark"] body #odontogramaModal .odonto-tool-chip:hover { background: #2f2f34; }
html[data-theme="dark"] body #odontogramaModal .odonto-tool-chip.active { color: var(--om-on); }
html[data-theme="dark"] body #odontogramaModal .odonto-header-actions .secondary { background: var(--card-2); color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] body #odontogramaModal .odonto-ai-box.mic-on > .odonto-ai-input-row { background: linear-gradient(90deg, rgba(248, 113, 113, .12), var(--card) 60%); border-color: rgba(248, 113, 113, .4); }
html[data-theme="dark"] body #odontogramaModal .odonto-mic-big { box-shadow: 0 0 0 1px rgba(56, 189, 248, .35); }
html[data-theme="dark"] body #odontogramaModal .odonto-mic-big:hover { background: rgba(2, 132, 199, .34); }
html[data-theme="dark"] body #odontogramaModal .odonto-ai-textarea { color: var(--ink); }
html[data-theme="dark"] body #odontogramaModal .odonto-ai-box .odonto-ai-lb { color: var(--accent-strong); }
html[data-theme="dark"] body #odontogramaModal .odonto-ai-box.mic-on .odonto-ai-lb { color: var(--red); }
html[data-theme="dark"] body #odontogramaModal .odonto-stat-item[style*="background"] { background: var(--card-2) !important; border-color: var(--line) !important; color: var(--ink); }
html[data-theme="dark"] body #odontogramaModal .odonto-stat-item b { color: var(--ink); }
html[data-theme="dark"] body #odontogramaModal .odonto-seg button.on, html[data-theme="dark"] body #odontogramaModal .odonto-seg button.on * { color: #06121f; }
html[data-theme="dark"] body #odontogramaModal .odonto-ai-actions .odonto-mini-btn { color: var(--ink-2); }
