/* ---------- Diálogos y avisos ---------- */
dialog { color: var(--text); background: var(--card); border: 1px solid var(--line-2); border-radius: 22px; padding: 0; box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .8); }
dialog::backdrop { background: rgba(2, 8, 18, .66); backdrop-filter: blur(10px); }
.info-dialog { max-width: 520px; width: calc(100% - 32px); padding: 30px; }
.info-dialog-head { display: flex; align-items: center; justify-content: flex-end; }
.info-dialog-head button { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--hair); color: var(--text); }
.info-dialog h2 { font-size: 24px; margin: 16px 0 10px; }
.info-dialog p { font-size: 14.5px; line-height: 1.7; }
.info-dialog .btn { margin-top: 22px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 120; transform: translate(-50%, 24px); opacity: 0; pointer-events: none; max-width: min(520px, calc(100vw - 32px));
  background: var(--btn-bg); color: var(--btn-ink); padding: 13px 18px; border-radius: 14px; font-size: 14px; font-weight: 600; box-shadow: 0 20px 50px -16px rgba(0, 0, 0, .7); transition: all .4s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media print {
  .toast { display: none !important; }
}

/* ==========================================================================
   Piezas compartidas del recorrido: panel lateral, ficha técnica, métricas y trazabilidad
   ========================================================================== */
.drawer-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(2, 8, 18, .55); opacity: 0; transition: opacity .4s var(--ease); }
.drawer-backdrop.is-open { opacity: 1; }
.drawer {
  position: fixed; z-index: 91; top: 12px; right: 12px; bottom: 12px; width: min(560px, calc(100vw - 24px)); display: flex; flex-direction: column;
  border-radius: 26px; border: 1px solid var(--line-2); background: color-mix(in srgb, var(--card) 94%, transparent);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .8); transform: translateX(calc(100% + 28px)); opacity: 0; transition: transform .5s var(--ease), opacity .4s var(--ease); outline: none;
}
.drawer.is-open { transform: none; opacity: 1; }
.drawer--wide { width: min(720px, calc(100vw - 24px)); }
.drawer-head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 14px; }
.drawer-head h2 { font-size: 24px; line-height: 1.12; letter-spacing: -.04em; margin-top: 10px; }
.drawer-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 4px 24px 24px; display: grid; gap: 16px; align-content: start; scrollbar-width: thin; }
.drawer-body p { font-size: 14.5px; line-height: 1.7; }
.drawer-body h3 { font-size: 16px; letter-spacing: -.02em; }
.drawer-foot { flex: none; display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; padding: 14px 24px 20px; border-top: 1px solid var(--line); }
html.drawer-open { overflow: hidden; }

/* Paneles lateral → hoja inferior en celulares */
@media (max-width: 720px) {
  .drawer,
  .drawer--wide { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: min(88dvh, 780px); border-radius: 24px; transform: translateY(calc(100% + 28px)); }
  .drawer.is-open { transform: none; }
  .drawer-head { padding: 18px 18px 10px; }
  .drawer-body { padding: 4px 18px 18px; }
  .drawer-foot { padding: 12px 18px calc(16px + env(safe-area-inset-bottom)); }
  .drawer-head h2 { font-size: 21px; }
}

/* Contenidos de los paneles */
.drawer-detail { display: grid; gap: 12px; }
.drawer-detail .detail-head { display: flex; gap: 14px; align-items: center; }
.drawer-detail .detail-head h2 { font-size: 22px; }
.drawer .trace-tab { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; min-height: 34px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--glass); color: var(--text); font-size: 12.5px; font-weight: 600; transition: all .28s var(--ease); }
.drawer .trace-tab i { font-size: 12px; color: var(--accent); }
.drawer .trace-tab.is-active { background: var(--btn-bg); color: var(--btn-ink); border-color: transparent; }
.drawer .trace-tab.is-active i { color: var(--btn-ink); }
.drawer .preview .visual-ring { width: 100%; }
.drawer .bp-vocab { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.drawer .bp-vocab li { font: 500 10.5px/1 var(--mono); padding: 5px 8px; border-radius: 6px; border: 1px dashed var(--line-2); color: var(--text); }
.drawer-detail .detail-head { display: flex; justify-content: flex-start; align-items: center; gap: 14px; padding: 0; }
.drawer-detail .detail-head h2 { font-size: 22px; letter-spacing: -.04em; margin-top: 4px; }
.drawer .trace-hint { border-style: dashed; }
