/* HC V3 es una capa reversible: quitar .hc-layout-v3 restaura íntegramente la vista anterior. */
@media(min-width:701px){#modal-historia #hc-window.hc-layout-v3{position:relative!important;max-width:1120px!important;width:calc(100vw - 120px)!important;height:calc(100vh - 64px)!important;max-height:calc(100vh - 64px)!important;border-radius:18px!important;background:#f5f8fc!important;overflow:hidden!important}#modal-historia #hc-window.hc-layout-v3>div:first-child{border-radius:18px 18px 0 0!important}#modal-historia #hc-window.hc-layout-v3>div:first-child>div:last-child{margin-left:auto;min-width:0;gap:6px!important;flex-wrap:nowrap}.hc-layout-v3 #hc-patient-banner{padding:10px 22px!important}.hc-layout-v3 #hc-scroll-area{padding:16px 78px 16px 20px!important}.hc-layout-v3 #btn-hc-ai-toggle,.hc-layout-v3 #btn-hc-ai-autofill{display:none!important}}
.hc-layout-v3>.hc-tabs-bar{display:flex!important}#hc-v3-navigation{display:none!important}
.hc-v3-basicos-grid{display:grid;grid-template-columns:minmax(0,.94fr) minmax(0,1.06fr);gap:14px}.hc-v3-pane{min-width:0;padding:14px;border:1px solid #d9e4f0;border-radius:16px;background:#fff;box-shadow:0 5px 18px rgba(34,72,111,.045)}.hc-v3-pane>header{display:flex;align-items:center;gap:9px;margin-bottom:10px}.hc-v3-pane>header>.material-symbols-outlined{display:grid;place-items:center;width:35px;height:35px;border-radius:10px;background:#eaf4ff;color:#1375df}.hc-v3-pane>header b,.hc-v3-pane>header small{display:block}.hc-v3-pane>header b{color:#193552;font-size:.9rem}.hc-v3-pane>header small{margin-top:2px;color:#75879b;font-size:.68rem}.hc-v3-info>div:last-child{grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:10px 14px!important}.hc-v3-motivo #hc-motivo{min-height:82px!important}.hc-v3-motivo #hc-motivos-frecuentes{margin-top:8px}
#hc-v3-ai-rail{display:none}.hc-layout-v3 #hc-v3-ai-rail{position:absolute;z-index:45;right:12px;top:50%;transform:translateY(-38%);display:flex!important;width:52px;padding:7px 5px;flex-direction:column;align-items:center;gap:7px;border:1px solid rgba(124,58,237,.24);border-radius:18px;background:linear-gradient(165deg,rgba(255,255,255,.97),rgba(242,238,255,.96));box-shadow:0 14px 34px rgba(76,29,149,.2),inset 0 1px 0 #fff;backdrop-filter:blur(16px)}.hc-layout-v3 #hc-v3-ai-rail>button,.hc-layout-v3 #hc-v3-ai-rail>div>button{display:flex;align-items:center;justify-content:center;width:40px;height:40px;padding:0;border:0;border-radius:12px;cursor:pointer;color:#6042d7;background:#fff;box-shadow:0 2px 8px rgba(60,51,130,.1);transition:transform .18s ease,background .18s ease,color .18s ease}.hc-layout-v3 #hc-v3-ai-rail>button:hover,.hc-layout-v3 #hc-v3-ai-rail>div>button:hover{transform:translateY(-2px);background:#ede9fe;color:#4c1d95}.hc-layout-v3 #hc-v3-ai-rail .material-symbols-outlined{font-size:20px}.hc-layout-v3 #hc-v3-ai-rail b,.hc-layout-v3 #hc-v3-ai-rail small{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}.hc-layout-v3 #hc-v3-ai-rail>div{display:flex;flex-direction:column;gap:7px}.hc-layout-v3 #hc-v3-ai-rail [data-ai="toggle"]{position:relative;color:#fff;background:linear-gradient(145deg,#6d28d9,#2563eb)}.hc-layout-v3 #hc-v3-ai-rail [data-ai="toggle"]:after{content:"IA";position:absolute;right:-3px;bottom:-4px;padding:1px 4px;border:2px solid #fff;border-radius:999px;background:#172554;color:#fff;font-size:8px;font-weight:900;letter-spacing:.04em}.hc-layout-v3 #hc-v3-ai-rail[data-active="true"] [data-ai="toggle"]{background:linear-gradient(145deg,#7c3aed,#0ea5e9);box-shadow:0 0 0 4px rgba(124,58,237,.12),0 5px 14px rgba(76,29,149,.25)}.hc-layout-v3 #hc-v3-ai-rail[data-active="true"] [data-ai="toggle"] i{position:absolute;top:4px;right:4px;width:7px;height:7px;border:2px solid #fff;border-radius:50%;background:#34d399}.hc-layout-v3 #hc-v3-ai-rail[data-listening="true"] [data-ai="voice"]{color:#fff;background:linear-gradient(145deg,#ef4444,#c026d3);animation:hcV3Listening 1.2s ease-in-out infinite}.hc-layout-v3 #hc-v3-ai-rail .hc-v3-classic{display:none!important}
@media(min-width:701px) and (max-width:900px){#modal-historia #hc-window.hc-layout-v3{width:calc(100vw - 24px)!important;height:calc(100vh - 24px)!important;max-height:calc(100vh - 24px)!important}#hc-v3-steps{display:flex;overflow-x:auto;scrollbar-width:none}#hc-v3-steps button{flex:0 0 135px}.hc-v3-basicos-grid{grid-template-columns:1fr}.hc-layout-v3 #hc-v3-ai-rail{right:8px;width:48px}.hc-layout-v3 #hc-scroll-area{padding-right:66px!important}.hc-v3-info>div:last-child{grid-template-columns:1fr 1fr!important}}
@media(max-width:700px){#hc-v3-navigation{padding:0 9px}#hc-v3-steps button{min-height:48px;flex-basis:116px;font-size:.7rem}#hc-v3-steps button i{width:24px;height:24px}.hc-layout-v3 #hc-v3-ai-rail{display:none}.hc-v3-basicos-grid{display:block}.hc-v3-pane{padding:12px;border-radius:13px}.hc-v3-pane+.hc-v3-pane{margin-top:10px}.hc-v3-info>div:last-child{grid-template-columns:1fr!important}}
#hc-v3-enable,#hc-v3-classic-header{display:none!important}#hc-v3-dictation{display:none;align-items:center;gap:5px;height:32px;padding:0 10px;border:0;border-radius:9px;background:linear-gradient(135deg,#0f79da,#5b51d8);color:#fff;box-shadow:0 3px 10px rgba(54,74,190,.28);font-size:.68rem;font-weight:800;cursor:pointer;white-space:nowrap}.hc-layout-v3 #hc-v3-dictation{display:inline-flex}#hc-v3-dictation .material-symbols-outlined{font-size:16px}.hc-layout-v3 #hc-v3-dictation.is-listening{background:linear-gradient(135deg,#ef4444,#c026d3);animation:hcV3Listening 1.2s ease-in-out infinite}@keyframes hcV3Listening{50%{box-shadow:0 0 0 5px rgba(239,68,68,.18)}}
@media(max-width:1050px){.hc-layout-v3 #hc-v3-classic-header b,.hc-layout-v3 #hc-v3-dictation b{display:none}.hc-layout-v3 #hc-v3-classic-header,.hc-layout-v3 #hc-v3-dictation{width:34px;padding:0;justify-content:center}}
@media(max-width:700px){#hc-v3-classic-header,#hc-v3-dictation{display:none!important}}

/* Presentación clínica clásica: lectura vertical, sin dividir Básicos en dos columnas. */
@media(min-width:701px){
  .hc-layout-v3 .hc-v3-basicos-grid{display:block!important}
  .hc-layout-v3 .hc-v3-pane+.hc-v3-pane{margin-top:10px}
  .hc-layout-v3 #hc-scroll-area{padding:12px 16px!important}
  .hc-layout-v3 #hc-v3-ai-rail{display:none!important}
  .hc-layout-v3 #btn-hc-ai-toggle,.hc-layout-v3 #btn-hc-ai-autofill{display:inline-flex!important}
  .hc-layout-v3 #hc-v3-dictation{display:none!important}
  .hc-layout-v3 #hc-smart-toolbar{display:flex!important;margin:0 auto 0 0!important;padding:0!important;border:0!important;background:transparent!important;border-radius:0!important}

  /* Los estados de ventana deben ganar a las dimensiones de la vista normal. */
  #modal-historia #hc-window.hc-layout-v3[data-maximized="true"],
  #modal-historia #hc-window.hc-layout-v3.hc-fullscreen-mode{
    position:fixed!important;
    inset:0!important;
    width:100vw!important;
    height:100vh!important;
    max-width:none!important;
    max-height:none!important;
    margin:0!important;
    border-radius:0!important;
  }
  #modal-historia #hc-window.hc-layout-v3[data-maximized="true"]>div:first-child,
  #modal-historia #hc-window.hc-layout-v3.hc-fullscreen-mode>div:first-child{border-radius:0!important}
}

.hc-expiry-controls{display:grid;grid-template-columns:minmax(0,1fr) 118px;gap:6px;align-items:stretch}.hc-expiry-controls #hc-vigencia-rapida{width:100%!important;min-width:0!important;height:auto!important;min-height:0!important;padding:6px 24px 6px 8px!important;border:1px solid #a9c9ee!important;border-radius:10px!important;background:#eef6ff!important;color:#1265bc!important;font-size:.7rem!important;font-weight:800!important;cursor:pointer}.hc-expiry-controls #hc-vencimiento{min-width:0!important}
@media(max-width:700px){.hc-expiry-controls{grid-template-columns:minmax(0,1fr) 112px}.hc-expiry-controls #hc-vigencia-rapida{font-size:.72rem!important}}
