/* Font setup */
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

/* Smooth transitions for theme changes */
* {
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.bg-gradient-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('/static/images/noise.svg');
  opacity: 0.05;
  pointer-events: none;
  z-index: 0;
}

.toast-item {
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  will-change: opacity, transform;
}
.toast-item.fade-out {
  opacity: 0;
  transform: translateY(-12px);
}

.mm-toast-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  pointer-events: none;
  padding: 0.75rem;
}

.mm-toast {
  --mm-toast-bg: #ffffff;
  --mm-toast-text: #0f172a;
  --mm-toast-border: rgba(15, 23, 42, 0.08);
  --mm-toast-accent: #2563eb;
  --mm-toast-icon-bg: rgba(37, 99, 235, 0.12);
  --mm-toast-icon-color: #2563eb;
  --mm-toast-close: rgba(15, 23, 42, 0.45);
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: fit-content;
  min-width: 260px;
  max-width: min(90vw, 540px);
  padding: 0.75rem 0.85rem;
  border-radius: 0.75rem;
  background: var(--mm-toast-bg);
  color: var(--mm-toast-text);
  border: 1px solid var(--mm-toast-border);
  border-left: 4px solid var(--mm-toast-accent);
  box-shadow:
    0 12px 30px -15px rgba(15, 23, 42, 0.35),
    0 6px 18px -12px rgba(15, 23, 42, 0.25);
  transform: translateY(0);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.mm-toast:hover {
  transform: translateY(-2px);
  color: var(--mm-toast-text);
  box-shadow:
    0 16px 32px -18px rgba(15, 23, 42, 0.45),
    0 10px 24px -16px rgba(15, 23, 42, 0.25);
}

.mm-toast__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: var(--mm-toast-icon-bg);
  color: var(--mm-toast-icon-color);
}

.mm-toast__icon-svg {
  width: 1.1rem;
  height: 1.1rem;
}

.mm-toast__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mm-toast__title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.mm-toast__message {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  word-break: break-word;
}

.mm-toast__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.5rem;
  border: none;
  border-radius: 9999px;
  background: transparent;
  color: var(--mm-toast-close);
  width: 1.75rem;
  height: 1.75rem;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.mm-toast__close:hover {
  color: var(--mm-toast-text);
  background: rgba(15, 23, 42, 0.08);
  transform: scale(1.05);
}

.mm-toast__close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
}

.mm-toast__close span {
  display: block;
  margin-top: -0.1rem;
}

.mm-toast--success {
  --mm-toast-accent: #22c55e;
  --mm-toast-border: rgba(34, 197, 94, 0.18);
  --mm-toast-icon-bg: rgba(34, 197, 94, 0.16);
  --mm-toast-icon-color: #16a34a;
}

.mm-toast--error {
  --mm-toast-accent: #ef4444;
  --mm-toast-border: rgba(239, 68, 68, 0.18);
  --mm-toast-icon-bg: rgba(248, 113, 113, 0.18);
  --mm-toast-icon-color: #dc2626;
}

.mm-toast--warning {
  --mm-toast-accent: #f59e0b;
  --mm-toast-border: rgba(245, 158, 11, 0.22);
  --mm-toast-icon-bg: rgba(245, 158, 11, 0.2);
  --mm-toast-icon-color: #d97706;
}

.mm-toast--info {
  --mm-toast-accent: #3b82f6;
  --mm-toast-border: rgba(59, 130, 246, 0.18);
  --mm-toast-icon-bg: rgba(59, 130, 246, 0.16);
  --mm-toast-icon-color: #2563eb;
}

@media (prefers-color-scheme: dark) {
  .mm-toast {
    --mm-toast-bg: rgba(15, 23, 42, 0.92);
    --mm-toast-text: #e2e8f0;
    --mm-toast-border: rgba(148, 163, 184, 0.25);
    --mm-toast-close: rgba(226, 232, 240, 0.6);
    box-shadow:
      0 18px 30px -18px rgba(2, 6, 23, 0.75),
      0 12px 24px -16px rgba(15, 23, 42, 0.6);
  }

  .mm-toast--success {
    --mm-toast-icon-bg: rgba(34, 197, 94, 0.28);
  }

  .mm-toast--error {
    --mm-toast-icon-bg: rgba(248, 113, 113, 0.28);
  }

  .mm-toast--warning {
    --mm-toast-icon-bg: rgba(245, 158, 11, 0.32);
  }

  .mm-toast--info {
    --mm-toast-icon-bg: rgba(59, 130, 246, 0.28);
  }
}

.modal-trigger * {
  pointer-events: none;
}

/* Lightweight CSS spinner (CSP-safe, no data: URLs) */
.mm-spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid rgba(37, 99, 235, 0.2); /* blue-600 @ 20% */
  border-top-color: #2563eb; /* blue-600 */
  border-radius: 50%;
  animation: mm-spin 1s linear infinite;
}

@keyframes mm-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Tiny spin utility for icons */
.mm-spin {
  display: inline-block;
  animation: mm-spin 1s linear infinite;
}

:root {
  --mm-btn-radius: 0.75rem;
  --mm-btn-shadow: 0 14px 28px -18px rgba(15, 23, 42, 0.45);
  --mm-btn-shadow-hover: 0 18px 34px -18px rgba(15, 23, 42, 0.5);
  --mm-btn-shadow-active: 0 8px 18px -12px rgba(15, 23, 42, 0.45);
  --mm-badge-radius: 9999px;
  --mm-badge-shadow: 0 18px 36px -22px rgba(15, 23, 42, 0.55);
  --mm-badge-gap: 0.45rem;
}

:where(.btn) {
  border-radius: var(--mm-btn-radius);
  text-transform: none;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    transform 0.18s ease,
    box-shadow 0.25s ease;
  box-shadow: var(--mm-btn-shadow);
  border-width: 1px;
  border-color: transparent;
  background-color: #f8fafc;
  color: #0f172a;
}

:where(.btn):hover {
  transform: translateY(-1px);
  box-shadow: var(--mm-btn-shadow-hover);
}

:where(.btn):active {
  transform: translateY(0);
  box-shadow: var(--mm-btn-shadow-active);
}

:where(.btn):focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(37, 99, 235, 0.32),
    var(--mm-btn-shadow);
}

:where(.btn:disabled,
  .btn[disabled],
  .btn.btn-disabled) {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

:where(.btn.btn-circle) {
  border-radius: 9999px;
  box-shadow: none;
}

:where(.btn-primary) {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-color: rgba(37, 99, 235, 0.2);
  color: #f8fafc;
}
:where(.btn-primary:hover) {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

:where(.btn-success) {
  background: linear-gradient(135deg, #34d399, #059669);
  border-color: rgba(16, 185, 129, 0.25);
  color: #f0fdf4;
}
:where(.btn-success:hover) {
  background: linear-gradient(135deg, #059669, #047857);
}

:where(.btn-error) {
  background: linear-gradient(135deg, #f87171, #dc2626);
  border-color: rgba(239, 68, 68, 0.25);
  color: #fef2f2;
}
:where(.btn-error:hover) {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
}

:where(.btn-info) {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  border-color: rgba(2, 132, 199, 0.25);
  color: #f0f9ff;
}
:where(.btn-info:hover) {
  background: linear-gradient(135deg, #0284c7, #0369a1);
}

:where(.btn-secondary) {
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  border-color: rgba(124, 58, 237, 0.25);
  color: #faf5ff;
}
:where(.btn-secondary:hover) {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
}

:where(.btn-outline) {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  color: #0f172a;
  box-shadow: none;
}
:where(.btn-outline:hover) {
  background: rgba(15, 23, 42, 0.05);
  border-color: rgba(15, 23, 42, 0.18);
  box-shadow: none;
}

:where(.btn-outline.btn-primary) {
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.35);
}
:where(.btn-outline.btn-primary:hover) {
  background: rgba(37, 99, 235, 0.08);
}

:where(.btn-outline.btn-success) {
  color: #047857;
  border-color: rgba(16, 185, 129, 0.35);
}
:where(.btn-outline.btn-success:hover) {
  background: rgba(16, 185, 129, 0.1);
}

:where(.btn-outline.btn-error) {
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.35);
}
:where(.btn-outline.btn-error:hover) {
  background: rgba(239, 68, 68, 0.1);
}

:where(.btn-outline.btn-secondary) {
  color: #6d28d9;
  border-color: rgba(124, 58, 237, 0.35);
}
:where(.btn-outline.btn-secondary:hover) {
  background: rgba(124, 58, 237, 0.08);
}

:where(.btn-ghost) {
  background: transparent;
  border-color: transparent;
  color: #475569;
  box-shadow: none;
}
:where(.btn-ghost:hover) {
  background: rgba(15, 23, 42, 0.04);
  color: #0f172a;
}

:where(.btn-link) {
  background: transparent;
  border-color: transparent;
  color: #2563eb;
  box-shadow: none;
}
:where(.btn-link:hover) {
  text-decoration: underline;
  color: #1d4ed8;
}

:where(.btn-xs) {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  border-radius: 0.6rem;
}

:where(.btn-sm) {
  padding: 0.5rem 0.85rem;
  font-size: 0.8125rem;
  border-radius: 0.7rem;
}

:where(.btn-lg) {
  padding: 0.85rem 1.4rem;
  font-size: 0.95rem;
  border-radius: 0.85rem;
}

:where(.btn-wide) {
  padding-left: 2.75rem;
  padding-right: 2.75rem;
}

@media (prefers-color-scheme: dark) {
  :where(.btn) {
    background-color: rgba(30, 41, 59, 0.9);
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.2);
    box-shadow: 0 12px 26px -16px rgba(2, 6, 23, 0.85);
  }

  :where(.btn-outline) {
    background: rgba(15, 23, 42, 0.35);
    border-color: rgba(148, 163, 184, 0.25);
    color: #e2e8f0;
  }

  :where(.btn-ghost) {
    color: #cbd5f5;
  }

  :where(.btn-outline.btn-primary) {
    color: #60a5fa;
  }

  :where(.btn-outline.btn-success) {
    color: #34d399;
  }

  :where(.btn-outline.btn-error) {
    color: #fca5a5;
  }

  :where(.btn-outline.btn-secondary) {
    color: #c4b5fd;
  }
}

/* Badge styling */
:where(.badge) {
  display: inline-flex;
  align-items: center;
  gap: var(--mm-badge-gap);
  padding: 0.35rem 0.7rem;
  border-radius: var(--mm-badge-radius);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #1f2937;
  background: rgba(248, 250, 252, 0.82);
  box-shadow: var(--mm-badge-shadow);
  backdrop-filter: blur(14px);
}

:where(.badge i) {
  font-size: 0.85rem;
}

:where(.badge-neutral) {
  background: linear-gradient(135deg, rgba(229, 231, 235, 0.95), rgba(209, 213, 219, 0.92));
  border-color: rgba(100, 116, 139, 0.45);
  color: #1f2937;
}

:where(.badge-primary) {
  background: linear-gradient(135deg, rgba(219, 234, 254, 0.92), rgba(191, 219, 254, 0.92));
  border-color: rgba(37, 99, 235, 0.35);
  color: #1d4ed8;
}

:where(.badge-secondary) {
  background: linear-gradient(135deg, rgba(233, 213, 255, 0.92), rgba(216, 180, 254, 0.92));
  border-color: rgba(124, 58, 237, 0.35);
  color: #7c3aed;
}

:where(.badge-info) {
  background: linear-gradient(135deg, rgba(224, 242, 254, 0.92), rgba(186, 230, 253, 0.92));
  border-color: rgba(14, 165, 233, 0.35);
  color: #0369a1;
}

:where(.badge-success) {
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.92), rgba(209, 250, 229, 0.92));
  border-color: rgba(16, 185, 129, 0.35);
  color: #047857;
}

:where(.badge-warning) {
  background: linear-gradient(135deg, rgba(254, 249, 195, 0.92), rgba(253, 224, 71, 0.85));
  border-color: rgba(217, 119, 6, 0.35);
  color: #b45309;
}

:where(.badge-error) {
  background: linear-gradient(135deg, rgba(254, 226, 226, 0.92), rgba(254, 202, 202, 0.9));
  border-color: rgba(239, 68, 68, 0.35);
  color: #b91c1c;
}

:where(.badge-ghost) {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(203, 213, 225, 0.35);
  color: #64748b;
  box-shadow: none;
}

:where(.badge-outline) {
  background: rgba(248, 250, 252, 0.35);
  border-style: solid;
  border-color: rgba(148, 163, 184, 0.4);
  box-shadow: none;
}

:where(.badge-outline.badge-primary) {
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.55);
}

:where(.badge-outline.badge-secondary) {
  color: #7c3aed;
  border-color: rgba(124, 58, 237, 0.55);
}

:where(.badge-outline.badge-success) {
  color: #047857;
  border-color: rgba(16, 185, 129, 0.55);
}

:where(.badge-outline.badge-info) {
  color: #0369a1;
  border-color: rgba(14, 165, 233, 0.5);
}

:where(.badge-outline.badge-warning) {
  color: #b45309;
  border-color: rgba(217, 119, 6, 0.55);
}

:where(.badge-outline.badge-error) {
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.55);
}

:where(.badge-outline.badge-neutral) {
  color: #1f2937;
  border-color: rgba(100, 116, 139, 0.55);
}

.mm-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding-right: 0.75rem;
  padding-left: 0.45rem;
  min-height: 1.5rem;
  position: relative;
  box-shadow: 0 20px 40px -24px rgba(15, 23, 42, 0.55);
}

.mm-badge__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.18);
  color: inherit;
  font-size: 0.62rem;
  flex-shrink: 0;
}

.mm-badge__label {
  line-height: 1;
}

.mm-badge--pending {
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.95), rgba(253, 230, 138, 0.92));
  border-color: rgba(217, 119, 6, 0.35);
  color: #b45309;
}

.mm-badge--processing {
  background: linear-gradient(135deg, rgba(224, 242, 254, 0.95), rgba(186, 230, 253, 0.92));
  border-color: rgba(14, 165, 233, 0.35);
  color: #0369a1;
}

.mm-badge--completed {
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.95), rgba(209, 250, 229, 0.92));
  border-color: rgba(16, 185, 129, 0.35);
  color: #047857;
}

.mm-badge--failed {
  background: linear-gradient(135deg, rgba(254, 226, 226, 0.95), rgba(254, 202, 202, 0.92));
  border-color: rgba(239, 68, 68, 0.35);
  color: #b91c1c;
}

.mm-badge--expired {
  background: linear-gradient(135deg, rgba(226, 232, 240, 0.92), rgba(203, 213, 225, 0.92));
  border-color: rgba(148, 163, 184, 0.4);
  color: #475569;
}

.mm-badge--processing .mm-badge__icon {
  color: #0284c7;
}

.mm-badge--pending .mm-badge__icon {
  color: #d97706;
}

.mm-badge--completed .mm-badge__icon {
  color: #059669;
}

.mm-badge--failed .mm-badge__icon {
  color: #dc2626;
}

.mm-badge--expired .mm-badge__icon {
  color: #475569;
}

@media (prefers-color-scheme: dark) {
  :where(.badge) {
    background: rgba(30, 41, 59, 0.75);
    border-color: rgba(148, 163, 184, 0.35);
    color: #e2e8f0;
    box-shadow: 0 18px 36px -22px rgba(2, 6, 23, 0.75);
  }

  :where(.badge-ghost) {
    background: rgba(15, 23, 42, 0.3);
    border-color: rgba(148, 163, 184, 0.25);
    color: #cbd5f5;
  }

  :where(.badge-outline) {
    background: rgba(15, 23, 42, 0.35);
    border-color: rgba(148, 163, 184, 0.45);
    color: #e2e8f0;
  }

  :where(.badge-neutral) {
    background: rgba(51, 65, 85, 0.72);
    border-color: rgba(148, 163, 184, 0.45);
    color: #e2e8f0;
  }

  :where(.badge-outline.badge-neutral) {
    color: #cbd5f5;
    border-color: rgba(148, 163, 184, 0.55);
  }

  .mm-badge {
    background: rgba(30, 41, 59, 0.78);
    border-color: rgba(148, 163, 184, 0.35);
    color: #e2e8f0;
  }

  .mm-badge__icon {
    background: rgba(15, 23, 42, 0.65);
    color: inherit;
    width: 1rem;
    height: 1rem;
    font-size: 0.62rem;
  }

  .mm-badge--pending {
    color: #facc15;
  }

  .mm-badge--processing {
    color: #60a5fa;
  }

  .mm-badge--completed {
    color: #34d399;
  }

  .mm-badge--failed {
    color: #fca5a5;
  }

  .mm-badge--expired {
    color: #cbd5f5;
  }
}
.mm-badge__icon > i {
  font-size: 0.65rem;
  line-height: 1;
}
