/* The modal system. Three layers like CodyChat: small, large, and "over" (opens on top of another). JS: assets/js/modal.js */
.modal-layer { position: fixed; inset: 0; z-index: var(--z-layer); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px 24px 12px; overflow-y: auto; background: var(--overlay); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: cb-fade .15s ease both; }
.modal-layer[data-layer="over"] { z-index: var(--z-over); }
.modal-box { position: relative; width: 100%; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); animation: cb-pop .18s ease both; }
.modal-small .modal-box { max-width: 400px; }
.modal-large .modal-box { max-width: 570px; overflow: hidden; }
.modal-large .modal-close { display: none; }
.modal-over .modal-box { max-width: 400px; }
.modal-body { padding: 36px 22px 22px 22px; }
.modal-large .modal-body { padding: 0; }
.modal-close { position: absolute; top: 10px; right: 10px; z-index: 2; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .35); color: #fff; font-size: 18px; line-height: 1; }
.modal-close:hover { background: rgba(0, 0, 0, .6); }
.modal-title { margin: 0 0 16px 0; font-size: var(--fs-lg); font-weight: 700; }
.modal-form { text-align: left; }
.modal-loading { display: flex; align-items: center; justify-content: center; min-height: 160px; }
.modal-loading .spin { display: block; width: 32px; height: 32px; border-color: var(--line); border-top-color: var(--accent); }
@keyframes cb-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cb-pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

@media (max-width: 480px) {
  .modal-layer { padding: 4vh 8px 16px 8px; }
  .modal-body { padding: 34px 16px 18px 16px; }
  .two { grid-template-columns: 1fr; gap: 0; }
}
