:root {
  --bg: #0e1424;
  --bg-2: #11192c;
  --line: #1c2740;
  --text: #e8eef8;
  --muted: #8b95ad;
  --faint: #6b7590;
  --accent: #8b7cf6;
  --accent-2: #6d5ef5;
  --card: #151d33;
  --danger: #f87171;
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100%;
}

a { color: inherit; text-decoration: none; }
button, input, select { font-family: inherit; }

.sidebar {
  width: 224px;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  padding: 22px 16px 16px;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.logo {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.02em;
  margin: 0 8px 28px;
  display: flex;
  align-items: center;
  gap: 2px;
}
.logo .at { color: var(--accent); font-weight: 700; margin-right: 4px; }

nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.nav-item svg { width: 18px; height: 18px; }
.nav-item:hover, .nav-item.active { color: var(--text); background: #182038; }

.side-note {
  margin-top: 28px;
  padding: 0 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--faint);
}
.side-foot { margin-top: auto; padding: 16px 8px 4px; color: var(--faint); font-size: 12px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 52px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
}
.addr {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  color: var(--muted);
}
.addr svg { width: 18px; height: 18px; flex-shrink: 0; }
.addr input {
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 14px;
  width: 100%;
  min-width: 0;
}
.top-actions { display: flex; gap: 4px; }
.icon-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: #182038; color: var(--text); }

.content { flex: 1; overflow: auto; }
.hero {
  max-width: 820px;
  margin: 48px auto 80px;
  padding: 0 24px;
  text-align: center;
}
.envelope { margin: 8px auto 18px; width: 220px; }
.hero h1 { font-size: 56px; letter-spacing: -.04em; font-weight: 700; margin: 8px 0 18px; }
.lead {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
  max-width: 720px;
  margin: 0 auto 28px;
}
.hero-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.btn {
  border: 0;
  cursor: pointer;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: #1a2340; color: var(--text); }
.btn.ghost:hover { background: #222c4c; }

.inbox { padding: 8px 0 40px; }
.mail-row {
  display: grid;
  grid-template-columns: 220px 1fr 160px;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  align-items: center;
}
.mail-row:hover { background: #141c32; }
.mail-row.unread .from, .mail-row.unread .subj { font-weight: 600; color: #fff; }
.from { color: var(--text); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subj { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.when { color: var(--faint); font-size: 12px; text-align: right; }
.clip { color: var(--accent); font-size: 12px; }

.empty { text-align: center; color: var(--muted); padding: 64px 20px; }

.message { max-width: 900px; margin: 0 auto; padding: 24px 28px 80px; }
.back { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: 14px; margin-bottom: 16px; }
.msg-h { font-size: 26px; letter-spacing: -.03em; margin-bottom: 10px; }
.msg-meta { color: var(--muted); font-size: 13px; line-height: 1.6; margin-bottom: 22px; }
.msg-body {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  white-space: pre-wrap;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.msg-html { background: #fff; color: #111; border-radius: var(--radius); overflow: hidden; }
.msg-html iframe { width: 100%; min-height: 360px; border: 0; background: #fff; }
.attach { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.attach a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #182038;
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
}
.attach a:hover { background: #1e2948; }

.menu { position: fixed; top: 56px; right: 16px; z-index: 20; }
.menu-card {
  background: #171f36;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  min-width: 240px;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
.menu-item {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: var(--text);
  padding: 8px 4px;
  cursor: pointer;
  font-size: 14px;
}
.menu-item:hover { color: var(--accent); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; margin: 4px 0 10px; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 20, .62);
  display: grid;
  place-items: center;
  z-index: 30;
  padding: 16px;
}
.modal-card {
  width: min(440px, 100%);
  background: #151d33;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}
.modal-card h3 { font-size: 20px; margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 13px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 0; }
label input, label select, .row input, .row select {
  width: 100%;
  margin-top: 6px;
  background: #0f1628;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
}
label input:focus, label select:focus, .row input:focus, .row select:focus { border-color: var(--accent); }
.row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.row input, .row select { margin-top: 0; }
.at-sep { color: var(--muted); }
.modal-actions { display: flex; gap: 8px; margin-top: 18px; }
.error { color: var(--danger); font-size: 13px; margin-top: 10px; }
.hidden { display: none !important; }

@media (max-width: 820px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; }
  nav { flex-direction: row; }
  .side-note, .side-foot { display: none; }
  .hero h1 { font-size: 36px; }
  .mail-row { grid-template-columns: 1fr; gap: 4px; padding: 12px 16px; }
  .when { text-align: left; }
}
