:root {
  color-scheme: dark;
}

body {
  background-image: radial-gradient(circle at 50% -15%, rgba(61, 156, 253, 0.13), transparent 38%);
}

main {
  padding-bottom: 1rem !important;
}

.ambient {
  position: fixed;
  width: 22rem;
  height: 22rem;
  border-radius: 999px;
  filter: blur(100px);
  opacity: 0.12;
  pointer-events: none;
}

.ambient-one {
  top: 12%;
  left: -12rem;
  background: #3d9cfd;
}

.ambient-two {
  right: -14rem;
  bottom: 8%;
  background: #7c3aed;
}

.brand-mark {
  width: 3rem;
  height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #7fd9ff;
  border: 1px solid rgba(61, 156, 253, 0.35);
  border-radius: 1rem;
  background: linear-gradient(145deg, rgba(61, 156, 253, 0.2), rgba(61, 156, 253, 0.05));
  box-shadow: 0 0 30px rgba(61, 156, 253, 0.14);
}

.status-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: #7fd99a;
  box-shadow: 0 0 0 4px rgba(127, 217, 154, 0.12);
}

.btn {
  position: relative;
  overflow: hidden;
  border: none;
  border-radius: 0.75rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn:has(i:only-child) {
  padding: 0.5rem;
  aspect-ratio: 1;
  background: transparent;
  border: none;
  box-shadow: none;
}

.btn:has(i:only-child):hover {
  background: rgba(61, 156, 253, 0.1);
  transform: none;
  box-shadow: none;
}

.btn-danger:has(i:only-child):hover {
  background: rgba(240, 113, 120, 0.15);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-icon {
  width: 2.875rem;
  height: 2.875rem;
  padding: 0;
  flex: 0 0 auto;
  border-radius: 0.875rem;
}

.btn-primary {
  background: #3d9cfd;
  color: #041018;
}

.btn-primary:hover:not(:disabled) {
  background: #5aafff;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(61, 156, 253, 0.3);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.btn-ghost {
  background: #1a2230;
  color: #e8eef7;
  border: 1px solid #243044;
}

.btn-ghost:hover:not(:disabled) {
  background: #243044;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.btn-ghost:active:not(:disabled) {
  transform: translateY(0);
}

.btn-danger {
  background: transparent;
  color: #f07178;
  border: 1px solid rgba(240, 113, 120, 0.4);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(240, 113, 120, 0.12);
}

.status-ok {
  color: #7fd99a;
}

.status-err {
  color: #f07178;
}

.msg {
  background: #141a22;
  border: 1px solid #243044;
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}

.msg::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #3d9cfd;
  transform: scaleY(0);
  transition: transform 0.25s ease;
}

.msg:hover {
  border-color: #3d9cfd;
  background: #1a2230;
  transform: translateX(6px);
  box-shadow: 0 4px 12px rgba(61, 156, 253, 0.15);
}

.msg:hover::before {
  transform: scaleY(1);
}

.msg.active {
  border-color: #3d9cfd;
  background: #1a2230;
  box-shadow: 0 0 0 3px rgba(61, 156, 253, 0.2);
}

.msg.active::before {
  transform: scaleY(1);
}

.msg.is-loading {
  pointer-events: none;
  opacity: 0.7;
}

.msg.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(127, 217, 255, 0.08), transparent);
  animation: shimmer 1s linear infinite;
}

.msg-from {
  font-size: 0.8rem;
  color: #8b9bb4;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

.msg-subject {
  font-weight: 600;
  margin: 0.3rem 0 0.2rem;
  font-size: 0.95rem;
}

.msg-meta {
  font-size: 0.75rem;
  color: #8b9bb4;
}

.empty {
  text-align: center;
  color: #8b9bb4;
  padding: 3.5rem 2rem;
  border: 2px dashed #243044;
  border-radius: 1.25rem;
  font-size: 0.9rem;
  background: rgba(26, 34, 48, 0.3);
  line-height: 1.6;
}

.tab {
  background: transparent;
  border: 1px solid #243044;
  color: #8b9bb4;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
}

.tab:hover {
  border-color: #2d4d76;
  background: rgba(61, 156, 253, 0.08);
}

.tab.on {
  color: #e8eef7;
  border-color: #3d9cfd;
  background: #1a4a7a;
}

.body-pane {
  background: #1a2230;
  border: 1px solid #243044;
  border-radius: 0.75rem;
  padding: 1.25rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.6;
  max-height: 50vh;
  overflow: auto;
}

.body-pane.html-mode {
  white-space: normal;
  background: #fff;
  color: #111;
}

.domain-picker {
  position: relative;
  display: inline-block;
  min-width: 13rem;
}

.domain-control {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  padding: 0.625rem 2.5rem;
  color: #b9e9ff;
  background:
    linear-gradient(#141a22, #141a22) padding-box,
    linear-gradient(90deg, #7fd9ff, #3d9cfd, #ffffff, #3d9cfd, #7fd9ff) border-box;
  background-size: 100%, 300% 100%;
  animation: gradientShift 3s linear infinite;
  box-shadow: 0 0 22px rgba(61, 156, 253, 0.12);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

.domain-control:hover,
.domain-control:focus-visible,
.domain-control[aria-expanded="true"] {
  box-shadow: 0 0 28px rgba(61, 156, 253, 0.24);
}

.domain-control:focus-visible {
  outline: 2px solid #7fd9ff;
  outline-offset: 3px;
}

.domain-icon,
.domain-chevron {
  position: absolute;
  width: 1rem;
  height: 1rem;
  color: #7fd9ff;
  pointer-events: none;
}

.domain-icon {
  left: 0.875rem;
}

.domain-chevron {
  right: 0.875rem;
  transition: transform 0.2s ease;
}

.domain-control[aria-expanded="true"] .domain-chevron {
  transform: rotate(180deg);
}

.domain-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 0.5rem);
  left: 0;
  width: 100%;
  padding: 0.375rem;
  border: 1px solid #2e4563;
  border-radius: 0.875rem;
  background: #141a22;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45), 0 0 24px rgba(61, 156, 253, 0.12);
}

.domain-option {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 0;
  border-radius: 0.625rem;
  padding: 0.625rem 0.75rem;
  color: #cbd8e8;
  background: transparent;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.domain-option:hover,
.domain-option:focus-visible {
  color: #e7f5ff;
  background: #1d2a3a;
  outline: none;
}

.domain-option[aria-selected="true"] {
  color: #7fd9ff;
  background: rgba(61, 156, 253, 0.12);
}

@keyframes gradientShift {
  0% {
    background-position: 0% 0%, 0% 0%;
  }
  100% {
    background-position: 0% 0%, 300% 0%;
  }
}

.control-card {
  position: relative;
  isolation: isolate;
}

.control-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 8%;
  width: 84%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(127, 217, 255, 0.65), transparent);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.btn:focus-visible,
.tab:focus-visible,
#email:focus-visible,
input:focus-visible {
  outline: 2px solid #7fd9ff;
  outline-offset: 2px;
}

.btn.is-loading {
  opacity: 0.78;
  cursor: wait;
}

.spinner {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  animation: spin 0.7s linear infinite;
}

.skeleton-list {
  display: grid;
  gap: 0.75rem;
}

.skeleton-card {
  height: 6rem;
  border: 1px solid #243044;
  border-radius: 1rem;
  background: linear-gradient(100deg, #141a22 25%, #1f2a3a 45%, #141a22 65%);
  background-size: 200% 100%;
  animation: shimmer 1.25s ease-in-out infinite;
}

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

@keyframes shimmer {
  to { background-position: -200% 0; }
}

@media (max-width: 520px) {
  .action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .btn {
    padding-inline: 0.875rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
