.modal {
  width: min(92vw, 440px);
  max-width: calc(100vw - 2rem);
  max-height: calc(100svh - 2rem);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  box-sizing: border-box;
}

.modal::backdrop {
  background: rgba(23, 33, 28, 0.58);
  backdrop-filter: blur(2px);
}

.modal__panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 100%;
  max-width: 100%;
  max-height: calc(100svh - 3rem);
  min-width: 0;
  padding: clamp(var(--space-4), 5vw, var(--space-5));
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  box-sizing: border-box;
}

.modal__title {
  margin: 0;
  min-width: 0;
  width: 100%;
  font-size: 1.4rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.modal__text {
  margin: 0;
  min-width: 0;
  width: 100%;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.modal__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-2);
  min-width: 0;
}

.modal__actions .button {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #f7f5ef;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast--error {
  background: var(--danger);
}

.toast--success {
  background: var(--sage-strong);
}

@media (max-width: 520px) {
  .modal {
    width: calc(100vw - 2rem);
    max-width: calc(100vw - 2rem);
  }

  .modal__actions {
    flex-direction: column-reverse;
  }

  .modal__actions .button {
    width: 100%;
    flex-basis: auto;
  }

  .toast-region {
    right: max(16px, env(safe-area-inset-right, 0px));
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
  }
}
.toast-region {
  right: max(20px, env(safe-area-inset-right, 0px));
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
}
