* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Roboto, sans-serif;
  background: #f5f7fb;
  color: #1f2533;
  font-size: 14px;
}
a { color: #2a6df5; text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #eef1f7; padding: 1px 5px; border-radius: 3px; font-size: 13px; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px; background: #1f2533; color: #fff;
}
.topbar .brand { font-weight: 600; font-size: 16px; }
.topbar .user a { color: #b8d2ff; margin-left: 16px; }
.topbar .user span { margin-right: 8px; opacity: .9; }

.layout {
  display: grid; grid-template-columns: 280px 1fr;
  gap: 16px; padding: 16px 24px;
}
.sidebar {
  background: #fff; border-radius: 8px; padding: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
  height: fit-content;
  position: sticky; top: 16px;
}
.sidebar h3 { margin: 0 0 6px; font-size: 15px; }
.sidebar h4 { margin: 16px 0 6px; font-size: 13px; color: #5a6378; text-transform: uppercase; letter-spacing: .5px; }
.sidebar button {
  background: #2a6df5; color: #fff; border: 0; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 13px;
}
.sidebar button:hover { background: #1f5ad8; }
.muted { color: #8a93a8; font-size: 12px; margin: 4px 0; }

.badge {
  display: inline-block; background: #2a6df5; color: #fff;
  border-radius: 10px; padding: 1px 8px; font-size: 12px; margin-left: 6px;
}
.dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #c9d0de; margin-left: 6px; vertical-align: middle;
}
.dot.online { background: #2bd47d; box-shadow: 0 0 6px #2bd47d; }

.notify-list { list-style: none; padding: 0; margin: 8px 0 0; max-height: 50vh; overflow: auto; }
.notify-list li {
  padding: 8px 10px; border: 1px solid #eef1f7; border-radius: 6px; margin-bottom: 6px;
  font-size: 12px; background: #fbfcfe;
}
.notify-list .preview { color: #5a6378; }

.content {
  background: #fff; border-radius: 8px; padding: 18px 22px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
  min-height: 60vh;
}
.content.full { grid-column: 1 / -1; }
.content h2 { margin: 0 0 12px; font-size: 18px; }

.mail-table {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
.mail-table th, .mail-table td {
  text-align: left; padding: 10px 8px; border-bottom: 1px solid #eef1f7;
  vertical-align: top;
}
.mail-table th { font-weight: 600; color: #5a6378; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.mail-table tbody tr:hover { background: #fbfcfe; }
.mail-table .from { color: #1f2533; }
.mail-table .subject a { color: #1f2533; font-weight: 500; }
.mail-table .time { color: #8a93a8; font-size: 12px; }
.mail-table .empty { color: #8a93a8; padding: 24px; text-align: center; }

.new-row {
  animation: flash 1.6s ease-out;
}
@keyframes flash {
  0% { background: #fff7c2; }
  100% { background: transparent; }
}

/* 邮件详情 */
.mail-detail h1 { margin: 0 0 12px; font-size: 22px; word-break: break-word; }
.mail-detail .meta {
  width: 100%; border-collapse: collapse; margin-bottom: 14px;
  background: #fbfcfe; border-radius: 6px; overflow: hidden;
}
.mail-detail .meta th {
  text-align: left; padding: 6px 12px; width: 110px; color: #5a6378; font-weight: 500;
}
.mail-detail .meta td { padding: 6px 12px; word-break: break-all; }

.tabs { border-bottom: 1px solid #e2e6ef; margin-top: 8px; display: flex; gap: 4px; align-items: end; }
.tabs .tab {
  background: none; border: 0; padding: 8px 14px; cursor: pointer; font-size: 14px;
  color: #5a6378; border-radius: 6px 6px 0 0;
}
.tabs .tab.active { background: #f0f4ff; color: #2a6df5; font-weight: 600; }
.tabs .tab.right { margin-left: auto; color: #2a6df5; text-decoration: none; }
.tabs .tab.danger { color: #fff; }
.tabs .tab-delete-form { margin: 0; }
.tab-panel { display: none; padding: 14px 0; }
.tab-panel.active { display: block; }
pre.tab-panel {
  white-space: pre-wrap; word-break: break-word;
  background: #fbfcfe; padding: 14px; border-radius: 6px;
  max-height: 65vh; overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.55;
}
pre.tab-panel.raw { color: #555; font-size: 12px; }
#tab-html iframe { width: 100%; height: 65vh; border: 1px solid #e2e6ef; border-radius: 6px; background: #fff; }

/* 登录页 */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.card { background: #fff; padding: 28px 32px; border-radius: 10px; box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.auth-card { width: 360px; max-width: 92vw; }
.auth-card h1 { margin: 0 0 18px; font-size: 20px; text-align: center; }
.auth-card label { display: block; margin: 12px 0 4px; font-size: 13px; color: #5a6378; }
.auth-card input { width: 100%; padding: 9px 12px; border: 1px solid #d4d9e4; border-radius: 6px; font-size: 14px; }
.auth-card input:focus { outline: none; border-color: #2a6df5; }
.auth-card button { width: 100%; margin-top: 18px; background: #2a6df5; color: #fff; border: 0; padding: 10px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.auth-card button:hover { background: #1f5ad8; }
.auth-card .hint { margin-top: 18px; font-size: 12px; color: #8a93a8; line-height: 1.6; }
.alert { background: #fde7e7; color: #b71c1c; padding: 8px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 8px; }
.notice { background: #e7f3ff; color: #1f5ad8; padding: 8px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 8px; }

.mailbox-list { list-style: none; padding: 0; margin: 8px 0 0; max-height: 40vh; overflow: auto; }
.mailbox-list li { padding: 6px 0; border-bottom: 1px solid #f0f3fa; display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.tiny { font-size: 11px !important; padding: 2px 8px !important; }
.danger { background: #d63b3b !important; }
.danger:hover { background: #b32c2c !important; }
.inline-form { display: flex; gap: 4px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 90px; padding: 6px 8px; border: 1px solid #d4d9e4; border-radius: 4px; font-size: 12px; }
