:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #e3e6ea;
  --text: #1f2329;
  --muted: #8a9099;
  --primary: #2563eb;
  --primary-d: #1d4ed8;
  --danger: #dc2626;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { font-weight: 700; font-size: 18px; cursor: pointer; user-select: none; }
.topbar-actions { display: flex; gap: 8px; }
main { max-width: 960px; margin: 20px auto; padding: 0 16px; }
.btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.btn:hover { background: #f0f2f5; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-d); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.small { padding: 4px 10px; font-size: 13px; }

.auth-card {
  max-width: 360px;
  margin: 80px auto;
  background: var(--card);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.auth-card input {
  width: 100%;
  padding: 10px;
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.msg { color: var(--danger); font-size: 13px; min-height: 16px; margin-top: 8px; }

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.toolbar input, .toolbar select { padding: 8px; border: 1px solid var(--border); border-radius: 8px; }
#search { flex: 1; min-width: 180px; }

.mail-list { list-style: none; margin: 0; padding: 0; }
.mail-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
}
.mail-item:hover { border-color: var(--primary); }
.mail-item .row1 { display: flex; justify-content: space-between; gap: 12px; }
.mail-item .subject { font-weight: 600; }
.mail-item .date { color: var(--muted); font-size: 13px; white-space: nowrap; }
.mail-item .from { color: #374151; font-size: 14px; margin-top: 2px; }
.mail-item .preview { color: var(--muted); font-size: 13px; margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  display: inline-block;
  background: #eef2ff;
  color: var(--primary-d);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 12px;
  margin-top: 6px;
}

.email-view, .compose, .accounts { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.meta div { margin: 4px 0; font-size: 14px; }
.email-body { margin-top: 12px; line-height: 1.6; word-break: break-word; }
.email-body pre { white-space: pre-wrap; }

.account-list { list-style: none; padding: 0; }
.account-list li { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; }
.account-form input, .account-form select { width: 100%; padding: 8px; margin: 6px 0;
  border: 1px solid var(--border); border-radius: 8px; }
.account-form fieldset { border: 1px solid var(--border); border-radius: 8px; margin: 10px 0; padding: 10px; }
.compose-form label { display: block; margin: 10px 0; font-size: 14px; }
.compose-form input, .compose-form select, .compose-form textarea {
  width: 100%; padding: 9px; margin-top: 4px; border: 1px solid var(--border); border-radius: 8px; }
