/* Shared themed dialogs + toasts for lists, account, and catalog. */
.cd-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(29, 39, 77, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}
.cd-modal {
  background: #fff;
  color: var(--brand-space-cadet, #1d274d);
  border-radius: 12px;
  width: min(28rem, 100%);
  max-height: min(90vh, 40rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 48px rgba(29, 39, 77, 0.28);
  padding: 1.5rem 1.5rem 1.25rem;
  box-sizing: border-box;
}
.cd-modal-handle {
  display: none;
}
.cd-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  flex-shrink: 0;
}
.cd-modal-head h2 {
  margin: 0;
  font-family: Quicksand, system-ui, sans-serif;
  font-size: 1.2rem;
}
.cd-modal-x {
  border: 0;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  padding: 0.25rem 0.4rem;
  min-width: 2.5rem;
  min-height: 2.5rem;
  border-radius: 6px;
}
.cd-modal-x:hover {
  background: rgba(29, 39, 77, 0.08);
}
.cd-modal-body {
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.cd-modal-body label,
.cd-modal-body legend {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0.75rem 0 0.35rem;
}
.cd-modal-body label:first-child,
.cd-modal-body legend:first-child {
  margin-top: 0;
}
.cd-modal-body input[type='text'],
.cd-modal-body textarea,
.cd-modal-body select {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 1rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(29, 39, 77, 0.2);
  border-radius: 8px;
  color: inherit;
  background: #fff;
}
.cd-modal-body textarea {
  resize: vertical;
  min-height: 5rem;
}
.cd-modal-body .muted {
  color: #666;
  font-size: 0.95rem;
  margin: 0 0 0.5rem;
  line-height: 1.45;
}
.cd-reason-set {
  border: 1px solid rgba(29, 39, 77, 0.14);
  border-radius: 10px;
  padding: 0.45rem 0.55rem 0.55rem;
  margin: 0.35rem 0 0;
}
.cd-reason {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.25rem;
  margin: 0;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  min-height: 2.5rem;
}
.cd-reason input {
  width: 1.05rem;
  height: 1.05rem;
}
.cd-check-row {
  display: flex !important;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  margin-top: 0.85rem !important;
  min-height: 2.5rem;
}
.cd-check-row input {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
}
.cd-modal-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-shrink: 0;
}
.cd-btn {
  font: inherit;
  font-weight: 700;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  min-height: 2.75rem;
  cursor: pointer;
  border: 1px solid transparent;
}
.cd-btn.primary {
  background: #ff832e;
  color: #fff;
  border-color: #ff832e;
}
.cd-btn.primary:disabled,
.cd-btn.danger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.cd-btn.ghost {
  background: transparent;
  border-color: rgba(29, 39, 77, 0.22);
  color: inherit;
}
.cd-btn.danger {
  background: #8b1e1e;
  color: #fff;
  border-color: #8b1e1e;
}
.cd-modal-status {
  margin: 0.65rem 0 0;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.cd-modal-status.err {
  color: #8b1e1e;
}
.cd-pick-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  max-height: 16rem;
  overflow: auto;
  border: 1px solid rgba(29, 39, 77, 0.12);
  border-radius: 10px;
}
.cd-pick-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  text-align: left;
  border: 0;
  border-bottom: 1px solid rgba(29, 39, 77, 0.08);
  background: #fff;
  padding: 0.7rem 0.8rem;
  min-height: 2.75rem;
  font: inherit;
  cursor: pointer;
  color: inherit;
}
.cd-pick-item:last-child {
  border-bottom: 0;
}
.cd-pick-item:hover,
.cd-pick-item:focus-visible {
  background: rgba(255, 131, 46, 0.1);
  outline: none;
}
.cd-pick-name {
  font-weight: 700;
}
.cd-toast {
  position: fixed;
  left: 50%;
  bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 1300;
  background: #1d274d;
  color: #e0e1dd;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  max-width: min(28rem, calc(100vw - 2rem));
  box-shadow: 0 8px 24px rgba(29, 39, 77, 0.28);
  transition: opacity 220ms ease, transform 220ms ease;
}
.cd-toast.err {
  background: #8b1e1e;
  color: #fff;
}
.cd-toast.is-out {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
}
@media (max-width: 640px) {
  .cd-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .cd-modal {
    width: 100%;
    max-height: 92vh;
    max-height: min(92vh, 100dvh);
    border-radius: 16px 16px 0 0;
    align-self: flex-end;
    padding: 0.65rem 1.25rem max(1.25rem, env(safe-area-inset-bottom, 0px));
  }
  .cd-modal-handle {
    display: block;
    width: 2.5rem;
    height: 4px;
    border-radius: 999px;
    background: rgba(29, 39, 77, 0.22);
    margin: 0.2rem auto 0.55rem;
    flex-shrink: 0;
  }
  .cd-btn {
    min-height: 2.75rem;
  }
}
