:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface2: #f3f4f6;
  --border: #e5e7eb;
  --text: #111827;
  --text2: #6b7280;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --green: #059669;
  --green-light: #ecfdf5;
  --red: #dc2626;
  --red-light: #fef2f2;
  --orange: #d97706;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── HEADER ── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
}

/* ── MAIN CONTAINER ── */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ── EMAIL BAR ── */
.email-bar {
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-lg);
}

.email-bar-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.email-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.email-address {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  word-break: break-all;
}

.email-timer {
  font-size: 12px;
  color: var(--text2);
  margin-top: 8px;
}

/* ── BUTTONS ── */
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-outline { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--surface2); }

.btn-danger { background: var(--red-light); color: var(--red); border: 1px solid transparent; }
.btn-danger:hover { background: #fee2e2; }

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

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: transform 0.3s;
  z-index: 1000;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── INBOX ── */
.inbox {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.inbox-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.inbox-title {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.inbox-count {
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  min-width: 24px;
  text-align: center;
}

/* ── EMAIL LIST ── */
.email-list { list-style: none; }

.email-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.email-item:hover { background: var(--surface2); }
.email-item:last-child { border-bottom: none; }
.email-item.unread { background: var(--accent-light); }
.email-item.unread:hover { background: #dbeafe; }

.email-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 8px;
  flex-shrink: 0;
}
.email-item:not(.unread) .email-dot { background: transparent; }

.email-content { flex: 1; min-width: 0; }

.email-sender {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-subject {
  font-size: 14px;
  color: var(--text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-time {
  font-size: 12px;
  color: var(--text2);
  flex-shrink: 0;
  margin-top: 2px;
}

/* ── EMPTY STATE ── */
.empty-state {
  padding: 60px 20px;
  text-align: center;
}

.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.empty-text { font-size: 14px; color: var(--text2); }

/* ── EMAIL DETAIL VIEW ── */
.email-detail { display: none; }
.email-detail.active { display: block; }
.inbox-view.hidden { display: none; }

.email-detail-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.back-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.back-btn:hover { text-decoration: underline; }

.detail-subject { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.detail-meta { font-size: 13px; color: var(--text2); }

.detail-body {
  padding: 20px;
  font-size: 14px;
  line-height: 1.7;
  overflow-x: auto;
}
.detail-body iframe { width: 100%; min-height: 300px; border: none; }

/* ── LOADING BAR ── */
.loading-bar {
  height: 3px;
  background: var(--accent);
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  transition: width 0.3s;
  z-index: 999;
}
.loading-bar.active { width: 70%; }
.loading-bar.done { width: 100%; opacity: 0; transition: width 0.2s, opacity 0.3s 0.2s; }

/* ── HOW IT WORKS ── */
.how-it-works {
  margin-top: 32px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.how-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.step { padding: 16px; background: var(--surface2); border-radius: 8px; }

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.step-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.step-text { font-size: 13px; color: var(--text2); }

/* ── FOOTER ── */
.footer {
  margin-top: 40px;
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text2);
}

/* ── STATUS INDICATOR ── */
.status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--green);
}

.status-dot {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

/* ── ANIMATIONS ── */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinning { animation: spin 1s linear infinite; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .email-bar-row { flex-direction: column; align-items: stretch; }
  .email-address { font-size: 15px; }
  .btn-actions { justify-content: stretch; }
  .btn-actions .btn { flex: 1; justify-content: center; }
  .header { padding: 12px 16px; }
  .container { padding: 16px 12px; }
}
