@layer components {
/* ── Modal ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: oklch(20% 0.02 65 / 40%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: modalFade 0.15s ease-out;
}
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px oklch(0% 0 0 / 18%);
  animation: modalSlide 0.2s ease-out;
}
@keyframes modalSlide { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 22px 26px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--text);
  margin-bottom: 4px;
}
.modal-subtitle { font-size: 13px; color: var(--muted); }
.modal-close {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.modal-close:hover { background: oklch(92% 0.01 65); }

.modal-body {
  padding: 16px 26px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 26px 22px;
  border-top: 1px solid var(--border);
}
.modal--narrow { max-width: 420px; }
.modal-warning-text {
  font-size: 15px;
  color: var(--text-secondary, #444);
  line-height: 1.5;
}
.btn-danger {
  height: 34px;
  background: oklch(52% 0.2 25);
  color: #fff;
  border: none;
  padding: 0 18px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.btn-danger:hover { background: oklch(46% 0.2 25); }
.btn-danger form, .btn-danger input[type="submit"] {
  all: unset;
  cursor: pointer;
}

/* Native <dialog> modal (top layer, browser-managed backdrop/focus). */
.modal-dialog {
  inset: 0;
  margin: auto;
  width: calc(100% - 32px);
  max-width: 420px;
  padding: 0;
  border: none;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 10px 40px oklch(0% 0 0 / 18%);
}
.modal-dialog::backdrop { background: oklch(20% 0.02 65 / 40%); }
}
