:root {
  --bg: #f6f8fc;
  --panel: #ffffff;
  --border: #e3e8ef;
  --text: #1f2733;
  --muted: #6b7684;
  --accent: #2563eb;
  --accent-soft: #eaf1ff;
  --unread: #f0f5ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", Roboto, sans-serif;
  background: linear-gradient(135deg, #eef2ff, #f6f8fc);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

.guest {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

.g-header {
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 28px;
}

/* 搜索栏 */
.g-search {
  display: flex;
  gap: 10px;
  background: var(--panel);
  padding: 14px;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(16, 24, 40, 0.08);
}
.g-search input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  outline: none;
}
.g-search input:focus { border-color: var(--accent); }
.g-search button {
  padding: 12px 26px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.g-search button:hover { background: #1d4ed8; }

.g-hint {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin-top: 24px;
}

/* 结果列表 */
.g-list { list-style: none; margin: 22px 0 0; padding: 0; }
.g-loading, .g-empty { text-align: center; color: var(--muted); padding: 24px; }

.g-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.05s;
}
.g-item:hover { box-shadow: 0 4px 18px rgba(16, 24, 40, 0.1); }
.g-item:active { transform: scale(0.997); }
.g-item-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.g-from { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-date { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.g-subject { margin-top: 6px; font-size: 15px; color: var(--text); }

/* 详情弹窗 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-box {
  background: var(--panel);
  width: 100%;
  max-width: 760px;
  height: 82vh;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(16, 24, 40, 0.3);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}
.modal-close:hover { background: #e3e8ef; }
.modal-box h2 { margin: 0; padding: 20px 56px 10px 22px; font-size: 19px; }
.m-meta { padding: 0 22px 12px; border-bottom: 1px solid var(--border); }
.m-meta strong { font-size: 14px; }
.m-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.attachments { padding: 10px 22px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.attachments a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}
.m-body { flex: 1; border: none; width: 100%; background: #fff; }

@media (max-width: 520px) {
  .g-search { flex-direction: column; }
  .g-search button { width: 100%; }
}
