.raim-ui-root {
  --raim-ui-vv-height: 100dvh;
  position: fixed;
  z-index: 2147483000;
  inset: 0;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  color: #172033;
}

.raim-ui-modal-layer {
  position: fixed;
  z-index: 1;
  inset: 0;
  pointer-events: none;
}

.raim-ui-backdrop {
  box-sizing: border-box;
  position: fixed;
  z-index: 1;
  inset: 0;
  height: var(--raim-ui-vv-height, 100dvh);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  overscroll-behavior: contain;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgb(17 24 39 / 30%);
  pointer-events: auto;
}

.raim-ui-dialog {
  box-sizing: border-box;
  width: min(100%, 420px);
  max-height: calc(var(--raim-ui-vv-height, 100dvh) - max(40px, env(safe-area-inset-top)) - max(40px, env(safe-area-inset-bottom)));
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid rgb(15 23 42 / 8%);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 72px rgb(15 23 42 / 22%), 0 2px 8px rgb(15 23 42 / 10%);
  outline: none;
}

.raim-ui-title {
  margin: 0;
  padding: 22px 24px 0;
  color: #111827;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: .01em;
}

.raim-ui-content {
  padding: 14px 24px 4px;
}

.raim-ui-message {
  max-height: min(38vh, 260px);
  margin: 0;
  overflow: auto;
  color: #4b5563;
  font-size: 15px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.raim-ui-field {
  margin-top: 18px;
}

.raim-ui-input-label {
  display: block;
  margin: 0 0 8px;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.raim-ui-input {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 11px;
  background: #fff;
  color: #172033;
  font: inherit;
  font-size: 16px;
  line-height: 1.35;
  outline: none;
}

.raim-ui-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgb(37 99 235 / 16%);
}

.raim-ui-input[aria-invalid="true"] {
  border-color: #dc2626;
}

.raim-ui-error {
  margin: 7px 0 0;
  color: #b91c1c;
  font-size: 13px;
  line-height: 1.45;
}

.raim-ui-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 20px 24px 22px;
}

.raim-ui-button {
  min-width: 82px;
  min-height: 40px;
  margin: 0;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.raim-ui-button:focus-visible {
  outline: 3px solid rgb(37 99 235 / 28%);
  outline-offset: 2px;
}

.raim-ui-button:disabled {
  cursor: wait;
  opacity: .62;
}

.raim-ui-button-cancel {
  border-color: #e2e8f0;
  background: #f1f5f9;
  color: #475569;
}

.raim-ui-button-cancel:hover:not(:disabled) {
  background: #e2e8f0;
}

.raim-ui-button-confirm {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.raim-ui-button-confirm:hover:not(:disabled) {
  border-color: #1d4ed8;
  background: #1d4ed8;
}

.raim-ui-button-confirm:active:not(:disabled) {
  transform: translateY(1px);
}

.raim-ui-button-danger {
  border-color: #dc2626;
  background: #dc2626;
}

.raim-ui-button-danger:hover:not(:disabled) {
  border-color: #b91c1c;
  background: #b91c1c;
}

.raim-ui-toast-layer {
  position: fixed;
  z-index: 2;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  left: max(16px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.raim-ui-toast {
  box-sizing: border-box;
  width: fit-content;
  max-width: min(420px, 100%);
  padding: 11px 14px;
  border: 1px solid rgb(15 23 42 / 9%);
  border-radius: 12px;
  background: rgb(17 24 39 / 94%);
  box-shadow: 0 10px 28px rgb(15 23 42 / 18%);
  color: #fff;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  animation: raim-ui-toast-in .18s ease-out both;
}

.raim-ui-toast-danger {
  background: rgb(185 28 28 / 96%);
}

@keyframes raim-ui-toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
  .raim-ui-backdrop {
    align-items: flex-end;
    padding-top: max(16px, env(safe-area-inset-top));
  }

  .raim-ui-dialog {
    width: 100%;
    max-height: calc(var(--raim-ui-vv-height, 100dvh) - max(24px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom)));
    border-radius: 20px;
  }

  .raim-ui-title {
    padding: 20px 20px 0;
  }

  .raim-ui-content {
    padding: 12px 20px 2px;
  }

  .raim-ui-actions {
    padding: 18px 20px 20px;
  }

  .raim-ui-button {
    flex: 1 1 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .raim-ui-button,
  .raim-ui-toast {
    animation: none;
    transition: none;
  }
}

/* Existing simple confirmation shells only. Keep their own widths and do not
   affect member dark mode, image previews, or larger business form dialogs. */
.commerce-page:not(.c-dark) .c-dialog,
.me-service-page .me-modal-mask:not(.me-preview) .me-modal,
.raim-security-v2 .sec-dialog,
.ct-request-dialog {
  border-radius: 20px;
  background: #fff;
}

.commerce-page:not(.c-dark) .c-dialog h3,
.me-service-page .me-modal-mask:not(.me-preview) .me-modal h2,
.raim-security-v2 .sec-dialog h2,
.ct-request-dialog h2 {
  margin-bottom: 16px;
}

.commerce-page:not(.c-dark) .c-dialog-actions button,
.me-service-page .me-modal-mask:not(.me-preview) .me-modal-actions button,
.raim-security-v2 .sec-dialog-actions button,
.ct-request-dialog .ct-request-actions button {
  min-height: 42px;
}

/* The business page can remain dark; its confirmation surface uses the same UI. */
.commerce-page.c-dark .c-dialog {
  border-radius: 20px;
  border-color: #e5e7eb;
  background: #fff;
  color: #111827;
}
.commerce-page.c-dark .c-dialog h3 {
  margin-bottom: 16px;
  color: #111827;
}
.commerce-page.c-dark .c-dialog p {
  color: #4b5563;
}
.commerce-page.c-dark .c-dialog .c-dialog-actions button {
  min-height: 42px;
  border-color: transparent;
  border-radius: 10px;
  background: #f3f4f6;
  color: #4b5563;
}
.commerce-page.c-dark .c-dialog .c-dialog-actions button.primary {
  background: #2f80ed;
  color: #fff;
}
