/* ============================================================
   Modal compartido (panel y dashboards)
   ============================================================ */

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 4, 6, .55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade-in .2s ease both;
}
.modal-layer.is-morphing { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; transition: background .4s; }
@keyframes fade-in { from { opacity: 0; } }

.modal {
  position: relative;
  width: min(460px, 100%);
  display: grid;
  gap: 8px;
  padding: 22px;
  border-radius: 20px;
  background: linear-gradient(165deg, #1d1d23, #141418);
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px -30px #000;
  overflow: hidden;
  animation: m-in .3s var(--ease) both;
}
@keyframes m-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }

.m-err { margin: 2px 0 0; min-height: 1.2em; font-size: 13px; color: var(--red-hot); }
.m-actions { display: flex; justify-content: flex-end; align-items: center; gap: 18px; }

/* confirmar escribiendo el nombre (js/confirm-name.js) */
.cn-modal { width: min(400px, 100%); gap: 12px; padding: 24px; }
.cn-title { margin: 0; font-size: 18px; }
.cn-body { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-dim); }
.cn-label { font-size: 12.5px; color: var(--text-faint); }
.cn-label b { color: var(--text); font-weight: 600; user-select: all; }
.cn-input {
  height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
}
.cn-input:focus { border-color: var(--red-hot); }
.cn-modal .m-actions { margin-top: 4px; }

/* error: sacudida y se borra */
.modal.is-shaking { animation: shake .5s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(5px); }
  30%, 50%, 70% { transform: translateX(-9px); }
  40%, 60% { transform: translateX(9px); }
}
.modal.is-erasing { animation: erase .5s var(--ease) both; }
@keyframes erase { to { opacity: 0; transform: scale(.9); filter: blur(8px); } }

@media (prefers-reduced-motion: reduce) {
  .modal, .modal.is-shaking, .modal.is-erasing { animation: none; }
}
