* {
  box-sizing: border-box;
}

:root {
  --bg-1: #f8f2e8;
  --bg-2: #f2e6d6;
  --bg-3: #f7f1e8;
  --orb-1: rgba(211, 84, 47, 0.25);
  --orb-2: rgba(58, 110, 165, 0.25);
  --fg: #1d1a16;
  --muted: #5f5a52;
  --card: rgba(255, 255, 255, 0.8);
  --border: rgba(0, 0, 0, 0.12);
  --accent: #d3542f;
  --accent-2: #3a6ea5;
  --accent-3: #f0b429;
  --shadow: 0 18px 50px rgba(29, 26, 22, 0.18);
  --radius: 18px;
}

[data-theme="mono"] {
  --bg-1: #f5f5f5;
  --bg-2: #ededed;
  --bg-3: #f9f9f9;
  --orb-1: rgba(0, 0, 0, 0.08);
  --orb-2: rgba(0, 0, 0, 0.12);
  --fg: #111111;
  --muted: #4f4f4f;
  --card: rgba(255, 255, 255, 0.92);
  --border: rgba(0, 0, 0, 0.18);
  --accent: #0b0b0b;
  --accent-2: #333333;
  --accent-3: #666666;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--fg);
  font-family: "Space Grotesk", sans-serif;
  background:
    radial-gradient(circle at 18% 20%, var(--orb-1), transparent 55%),
    radial-gradient(circle at 82% 10%, var(--orb-2), transparent 50%),
    linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 50%, var(--bg-3) 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(0, 0, 0, 0.12) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.2;
  pointer-events: none;
  z-index: 0;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(1px);
  z-index: 0;
  opacity: 0.7;
}

.bg-orb-one {
  width: 320px;
  height: 320px;
  top: -80px;
  left: -60px;
  background: var(--orb-1);
}

.bg-orb-two {
  width: 260px;
  height: 260px;
  bottom: -40px;
  right: -20px;
  background: var(--orb-2);
}

.site-header,
.layout,
.site-footer {
  position: relative;
  z-index: 1;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px min(6vw, 64px) 12px;
}

.logo {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.layout {
  width: min(1200px, 92vw);
  margin: 0 auto 48px;
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(320px, 1fr);
  gap: 32px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: fadeUp 0.7s ease both;
}

.intro {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.eyebrow {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--muted);
}

h1 {
  font-size: clamp(2rem, 2.6vw + 1rem, 3rem);
  margin: 0;
}

.lead {
  font-size: 1.02rem;
  line-height: 1.6;
  margin: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.95rem;
}

.helper {
  font-size: 0.8rem;
  color: var(--muted);
}

.field input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  color: var(--fg);
}

.field input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 60%, white 40%);
  border-color: var(--accent);
}

.advanced {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.advanced summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 12px;
}

.advanced-grid {
  display: grid;
  gap: 12px;
}

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

button {
  font-family: "Space Grotesk", sans-serif;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.primary-btn {
  background: var(--accent);
  color: #ffffff;
  border: none;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.primary-btn:hover {
  transform: translateY(-1px);
}

.ghost-btn {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 12px;
}

.ghost-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent-2);
  text-decoration: underline;
  padding: 0;
}

.form-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.status {
  padding: 12px 14px;
  border-radius: 12px;
  border-left: 4px solid var(--accent-2);
  background: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
}

.status.ok {
  border-left-color: var(--accent-2);
}

.status.error {
  border-left-color: var(--accent);
  background: rgba(211, 84, 47, 0.15);
}

.privacy-card {
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.5);
}

.privacy-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.muted {
  color: var(--muted);
}

.inbox {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.inbox-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.6);
}

.metric-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.metric-value {
  font-size: 1.3rem;
  font-weight: 600;
}

.split {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(280px, 1fr);
  gap: 16px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 6px;
}

.list-item {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
  padding: 12px 14px;
  border-radius: 14px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: listIn 0.4s ease both;
  animation-delay: calc(var(--i) * 0.03s);
}

.list-item.active {
  border-color: var(--accent);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.list-subject {
  font-weight: 600;
  font-size: 0.98rem;
}

.list-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.list-snippet {
  font-size: 0.85rem;
}

.detail {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.75);
  min-height: 320px;
  overflow: hidden;
}

.detail h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.detail-meta {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.meta-label {
  min-width: 60px;
  font-weight: 600;
}

.detail-text {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.88rem;
  white-space: pre-wrap;
  line-height: 1.5;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 12px;
  padding: 12px;
}

.html-details {
  margin-top: 16px;
}

.html-details summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 10px;
}

.html-details iframe {
  width: 100%;
  min-height: 260px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
}

.raw {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.raw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.raw pre {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.06);
  max-height: 280px;
  overflow: auto;
}

.empty {
  padding: 16px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  color: var(--muted);
  text-align: center;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px min(6vw, 64px) 32px;
  font-size: 0.85rem;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes listIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

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