/* Historial de consultas (ChatGPC · Dr. Notes) */
.hist-fondo { position: fixed; inset: 0; z-index: 1150; background: rgba(15, 23, 42, .38); opacity: 0; transition: opacity .2s ease; }
.hist-fondo.visible { opacity: 1; }
.hist-drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 1160; width: min(420px, 100vw); display: flex; flex-direction: column;
    background: var(--superficie); border-left: 1px solid var(--linea); box-shadow: -24px 0 48px -24px rgba(15, 23, 42, .3);
    transform: translateX(104%); transition: transform .24s ease;
}
.hist-drawer.visible { transform: none; }
.hist-cab { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; }
.hist-cab h2 { margin: 0; font: 600 18px var(--f-titulo); color: var(--azul-oscuro); }
.hist-cerrar { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--linea); border-radius: 10px; background: var(--superficie); color: var(--text-2); cursor: pointer; }
.hist-cerrar:hover { background: var(--superficie-2); }
.hist-cerrar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.hist-herr { padding: 0 18px 10px; }
.hist-herr input { width: 100%; height: 40px; padding: 0 14px; border: 1px solid var(--linea); border-radius: 12px; background: var(--superficie-2); font: 14px var(--f-cuerpo); color: var(--text-main); outline: none; }
.hist-herr input:focus { border-color: var(--azul); background: var(--superficie); box-shadow: var(--anillo-foco); }
.hist-lista { flex: 1; min-height: 0; overflow-y: auto; padding: 0 10px 12px; overscroll-behavior: contain; }
.hist-grupo h3 { margin: 14px 8px 6px; font: 600 11px var(--f-cuerpo); letter-spacing: .6px; text-transform: uppercase; color: var(--text-3); }
.hist-item { display: flex; align-items: flex-start; gap: 6px; padding: 10px 8px 10px 10px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; }
.hist-item:hover, .hist-item:focus-visible { background: var(--azul-suave); border-color: var(--azul-borde); outline: none; }
.hist-item-cuerpo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hist-preg { font: 600 13.5px/1.35 var(--f-cuerpo); color: var(--text-main); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hist-res { font-size: 12.5px; line-height: 1.4; color: var(--text-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hist-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 2px; font-size: 11px; color: var(--ui-grey); }
.hist-chip { padding: 1px 8px; border-radius: 999px; border: 1px solid var(--linea); background: var(--superficie-2); font-weight: 600; color: var(--text-2); }
.hist-chip-av { background: var(--warn-bg); border-color: var(--warn-borde); color: var(--warn); }
.hist-quitar { flex: 0 0 auto; width: 26px; height: 26px; border: 0; border-radius: 8px; background: transparent; color: var(--ui-grey); font-size: 18px; line-height: 1; cursor: pointer; opacity: 0; }
.hist-item:hover .hist-quitar, .hist-item:focus-within .hist-quitar { opacity: 1; }
.hist-quitar:hover { background: var(--bad-bg); color: var(--bad); }
@media (hover: none) { .hist-quitar { opacity: 1; } }
.hist-mas { display: block; margin: 10px auto 0; padding: 8px 16px; border: 1px solid var(--linea); border-radius: 999px; background: var(--superficie); font: 500 13px var(--f-cuerpo); color: var(--text-2); cursor: pointer; }
.hist-mas:hover { border-color: var(--azul-borde); color: var(--azul); }
.hist-vacio { padding: 40px 18px; text-align: center; color: var(--text-3); font-size: 13.5px; }
.hist-vacio b { display: block; margin-bottom: 4px; color: var(--text-main); font-size: 15px; }
.hist-pie { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 18px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--linea); font-size: 12px; color: var(--text-3); }
.hist-borrar-todo { border: 0; background: none; padding: 4px 6px; font: 500 12px var(--f-cuerpo); color: var(--bad); cursor: pointer; border-radius: 8px; }
.hist-borrar-todo:hover { background: var(--bad-bg); }

/* Etiqueta sobre una respuesta reabierta desde el historial */
.hist-etiqueta { display: inline-block; margin-bottom: 8px; padding: 2px 10px; border-radius: 999px; background: var(--superficie-2); border: 1px solid var(--linea); font: 500 11px var(--f-cuerpo); color: var(--text-3); }
/* Nota de la búsqueda avanzada omitida */
.act-nota { padding: 8px 10px; border: 1px dashed var(--warn-borde); border-radius: 10px; background: var(--warn-bg); color: var(--warn); }
.act-opcion b { font-weight: 600; color: var(--warn); }
@media (prefers-reduced-motion: reduce) { .hist-drawer, .hist-fondo { transition: none; } }

/* Botón «Quitar» visible y con área táctil suficiente */
.hist-quitar { width: 34px; height: 34px; opacity: .55; }
@media (max-width: 720px) { .hist-quitar { width: 40px; height: 40px; opacity: 1; } }
