.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(2, 3, 8, 0.78);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(20, 16, 28, 0.96), rgba(10, 12, 20, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 60px 140px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(248, 113, 113, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.3s var(--ease);
}

.modal-backdrop.open .modal-card {
  transform: translateY(0) scale(1);
}

.modal-accent {
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, transparent, var(--accent-color, #f87171), transparent);
}

.modal-body {
  padding: 36px 36px 28px;
}

.modal-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.2), rgba(248, 113, 113, 0.05));
  border: 1px solid rgba(248, 113, 113, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fca5a5;
  margin-bottom: 22px;
}

.modal-icon-wrap.warn {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(251, 191, 36, 0.05));
  border-color: rgba(251, 191, 36, 0.3);
  color: #fcd34d;
}

.modal-icon-wrap.info {
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.2), rgba(125, 211, 252, 0.05));
  border-color: rgba(125, 211, 252, 0.3);
  color: #bae6fd;
}

.modal-icon-wrap svg { width: 26px; height: 26px; stroke-width: 1.6; }

.modal-error-code {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--ink-2);
  margin-bottom: 14px;
  letter-spacing: 0.04em;
}

.modal-error-code .code-tag {
  color: var(--accent-color, #fca5a5);
  font-weight: 600;
}

.modal-card h3 {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #fff;
  margin-bottom: 12px;
  line-height: 1.25;
}

.modal-card p {
  color: var(--ink-1);
  font-size: 15px;
  line-height: 1.55;
  margin-bottom: 20px;
}

.modal-detail {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--ink-2);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 24px;
  line-height: 1.5;
  word-break: break-all;
}

.modal-detail .k { color: var(--ink-3); }
.modal-detail .v { color: var(--ink-1); }

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-actions .btn {
  flex: 1;
  justify-content: center;
  padding: 12px 18px;
  font-size: 14px;
  min-width: 120px;
}

.modal-footer {
  padding: 16px 36px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--ink-3);
  font-family: 'JetBrains Mono', monospace;
}

.modal-footer .req-id {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background 0.2s ease;
  z-index: 5;
}

.modal-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.modal-close svg { width: 16px; height: 16px; }

.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: calc(100vw - 48px);
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(10, 12, 20, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  font-size: 13px;
  color: var(--ink-0);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  transform: translateX(110%);
  opacity: 0;
  transition: transform 0.4s var(--ease), opacity 0.3s ease;
  max-width: 360px;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast .toast-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(52, 211, 153, 0.12);
  color: #6ee7b7;
}

.toast .toast-icon svg { width: 14px; height: 14px; }

.toast .toast-text { flex: 1; min-width: 0; }

.toast .toast-text strong {
  color: #fff;
  font-weight: 500;
  display: block;
  margin-bottom: 2px;
}

.toast .toast-text span {
  color: var(--ink-2);
  font-size: 12px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
