:root {
  --bg: #0b0c10;
  --panel: rgba(16, 19, 28, 0.92);
  --panel-2: rgba(24, 29, 42, 0.94);
  --accent: #ffb347;
  --accent-2: #4dd0e1;
  --text: #f4f1eb;
  --muted: #9fa6b2;
  --border: #2a3244;
  --danger: #ff6b6b;
  --success: #6be585;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 15% 20%, #2b1d0f 0%, transparent 48%),
    radial-gradient(circle at 80% 0%, #12323a 0%, transparent 40%),
    linear-gradient(130deg, #0b0c10 30%, #0f141b 70%);
  min-height: 100vh;
}

.ambient {
  position: fixed;
  inset: auto 8% -120px auto;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 179, 71, 0.35), transparent 70%);
  filter: blur(3px);
  pointer-events: none;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 18px 28px;
  background: rgba(12, 14, 20, 0.75);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1.2px;
}

.tagline {
  color: var(--muted);
  font-size: 14px;
}

.top-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.pill {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(77, 208, 225, 0.15);
  color: var(--accent-2);
  border: 1px solid rgba(77, 208, 225, 0.35);
}

.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 64px;
  display: grid;
  gap: 22px;
}

.auth-shell {
  max-width: 520px;
}

.panel {
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
}

.panel-title h2,
.section-head h2 {
  margin: 0 0 6px;
}

.panel-title p,
.section-head .muted {
  margin: 0 0 12px;
  color: var(--muted);
}

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

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

label {
  display: block;
  margin: 12px 0;
  font-size: 14px;
  color: var(--muted);
}

input,
textarea {
  width: 100%;
  margin-top: 6px;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0b0c10;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
}

select {
  width: 100%;
  margin-top: 6px;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0b0c10;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
}

.template-block {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-top: 12px;
  background: rgba(7, 9, 12, 0.6);
}

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

.template-head h3 {
  margin: 0 0 6px;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.template-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(11, 12, 16, 0.9);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.template-card.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255, 179, 71, 0.35);
}

.template-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.template-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.template-chip {
  font-size: 11px;
  color: var(--muted);
}

.template-preview {
  margin-top: 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(10, 12, 16, 0.8);
}

.preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.preview-body {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--muted);
  max-height: 180px;
  overflow: auto;
  background: #0b0c10;
  border-radius: 10px;
  padding: 12px;
}

textarea {
  resize: vertical;
}

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

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.toggle input {
  width: auto;
  accent-color: var(--accent-2);
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
}

button {
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--accent);
  color: #1a140e;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(255, 179, 71, 0.35);
}

button.outline {
  background: transparent;
  border: 1px solid var(--accent-2);
  color: var(--accent-2);
}

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

.status {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.status.error {
  color: var(--danger);
}

.status.success {
  color: var(--success);
}

.mail-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 16px;
  margin-top: 16px;
}

.mail-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tab-bar {
  display: flex;
  gap: 8px;
}

.tab {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.tab.active {
  border-color: var(--accent);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 179, 71, 0.3);
}

.search input {
  background: rgba(7, 9, 12, 0.8);
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.message-card {
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 14px;
  background: rgba(7, 9, 12, 0.9);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.message-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(255, 179, 71, 0.35);
}

.message-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.message-card .subject {
  font-weight: 600;
  margin-bottom: 6px;
}

.message-card .meta {
  font-size: 12px;
  color: var(--muted);
}

.mail-reader {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  background: rgba(7, 9, 12, 0.95);
  min-height: 200px;
  max-height: 420px;
  overflow: auto;
}

.mail-reader h3 {
  margin-top: 0;
}

.placeholder {
  color: var(--muted);
  text-align: center;
  margin-top: 80px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: rgba(16, 19, 28, 0.95);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

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

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

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