:root {
  --bg: #eef3fb;
  --fg: #17243c;
  --muted: #68758b;
  --line: #e3e8f0;
  --card: #fff;
  --primary: #285de5;
  --danger: #c43d42;
  --ok: #1b7f5e;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
[hidden] { display: none !important; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--fg);
  background:
    radial-gradient(1200px 500px at 10% -10%, #dbe7ff 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #e7eefc 0%, transparent 50%),
    var(--bg);
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .6; cursor: wait; }
a { color: var(--primary); text-decoration: none; }
.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 12px; align-items: center; font-weight: 750; font-size: 20px; }
.brand-icon {
  width: 40px; height: 40px; border-radius: 12px; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 18px;
}
.brand small { display: block; font-size: 11px; color: #8591a5; letter-spacing: 2px; font-weight: 500; }
.pill { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: #13a77d; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 36px 20px 48px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 96px 16px 32px; }
.card {
  width: min(520px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 18px 50px #182b490d;
}
h1 { margin: 0 0 8px; font-size: 26px; letter-spacing: -.6px; }
.sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: #f3f6fb; border-radius: 10px; padding: 4px; margin-bottom: 18px; }
.tabs button { border: 0; background: transparent; padding: 10px; border-radius: 8px; color: #5d6b82; font-weight: 600; }
.tabs button.active { background: #fff; color: var(--fg); box-shadow: 0 2px 8px #1d3a6a12; }
label { display: block; font-size: 13px; font-weight: 650; margin: 0 0 8px; }
input, textarea, select {
  width: 100%; border: 1px solid #dce3ee; border-radius: 10px; padding: 12px 14px; background: #f8faff;
}
textarea { min-height: 140px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.7; }
.field { margin-bottom: 14px; }
.primary, .secondary, .danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 10px; padding: 12px 16px; font-weight: 650; border: 1px solid var(--line); background: #fff;
}
.primary { width: 100%; background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 4px 12px #285de526; }
.secondary { background: #fff; }
.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.error, .notice { padding: 11px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; }
.error { color: #aa3037; background: #fff1f2; border: 1px solid #ffd9dc; }
.notice { color: #255f4e; background: #effaf5; border: 1px solid #cfece1; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.7; margin-top: 10px; }
.mail-grid {
  display: grid; grid-template-columns: 340px minmax(0, 1fr);
  min-height: 70vh; background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
}
.mail-list, .reader { min-height: 0; display: flex; flex-direction: column; }
.mail-list { border-right: 1px solid var(--line); }
.list-head, .reader-bar { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.rows, .reader-content { overflow: auto; flex: 1; }
.message-row {
  width: 100%; border: 0; border-bottom: 1px solid #edf0f5; border-left: 3px solid transparent;
  padding: 16px 18px; text-align: left; background: #fff; display: block;
}
.message-row:hover { background: #f8faff; }
.message-row.active { background: #eff4ff; border-left-color: var(--primary); }
.row-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.row-top strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-top time { font-size: 12px; color: #8490a4; }
.message-row h3 { margin: 0 0 6px; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-row p { margin: 0; font-size: 13px; color: #75829a; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.reader-content { padding: 28px; }
.reader-content h2 { margin: 0 0 18px; font-size: 22px; line-height: 1.5; overflow-wrap: anywhere; }
.sender { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.avatar { width: 36px; height: 36px; border-radius: 10px; background: #e9efff; color: #3564c9; display: grid; place-items: center; font-weight: 700; }
.body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.9; margin: 0; padding-top: 20px; border-top: 1px solid var(--line); }
.code-box { background: #eef4ff; border: 1px solid #dce7ff; border-radius: 10px; padding: 14px 16px; margin-bottom: 18px; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.code-box b { font-family: ui-monospace, monospace; letter-spacing: 2px; font-size: 22px; color: var(--primary); }
.folder { display: flex; background: #f3f6fb; padding: 4px; border-radius: 10px; }
.folder button { border: 0; background: transparent; padding: 8px 12px; border-radius: 8px; font-weight: 650; color: #5d6b82; }
.folder button.active { background: #fff; color: var(--fg); }
.toolbar { display: flex; gap: 8px; align-items: center; }
.icon-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 10px; }
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
.table th { background: #f7f9fd; color: #5d6b82; font-size: 12px; }
.badge { display: inline-flex; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.on { background: #e8f8f1; color: var(--ok); }
.badge.off { background: #f4f6f9; color: #7a8699; }
.admin-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.admin-app {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}
.admin-nav {
  background: #12172a;
  color: #c5cbe0;
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
}
.nav-logo {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #fff;
  font-weight: 750;
  font-size: 18px;
  padding: 8px 10px 22px;
}
.nav-logo small { display: block; font-size: 11px; letter-spacing: 2px; color: #8b93ad; font-weight: 500; }
.nav-group { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-label {
  font-size: 12px;
  color: #7d86a3;
  padding: 8px 12px 6px;
  letter-spacing: 1px;
}
.nav-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #c5cbe0;
  border-radius: 10px;
  padding: 11px 14px;
  font-weight: 600;
}
.nav-item:hover { background: #1c2340; color: #fff; }
.nav-item.active { background: #2a2158; color: #fff; }
.nav-logout { margin-top: auto; color: #9aa3bd; }
.admin-content { padding: 28px 32px; overflow: auto; min-height: 0; }
.page { min-height: 0; display: flex; flex-direction: column; }
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 24px; }
.page-head .sub { margin: 0; }
.admin-search { padding: 14px 16px 10px; }
.search-hint { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; font-size: 13px; font-weight: 650; }
.search-hint.yes { color: #255f4e; background: #effaf5; border: 1px solid #cfece1; }
.search-hint.no { color: #aa3037; background: #fff1f2; border: 1px solid #ffd9dc; }
.account-list { max-width: 760px; overflow: auto; }
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: #5d6b82;
  font-size: 13px;
}
.pager select, .pager-jump input {
  width: auto;
  background: #fff;
  padding: 7px 10px;
}
.pager-pages { display: flex; align-items: center; gap: 4px; }
.pager-pages button {
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  color: var(--fg);
  padding: 0 8px;
}
.pager-pages button.active {
  background: #eef3ff;
  border-color: #c9d6f8;
  color: var(--primary);
  font-weight: 700;
}
.pager-pages button:disabled { opacity: .45; cursor: default; }
.pager-jump { display: inline-flex; align-items: center; gap: 6px; }
.pager-jump input { width: 64px; }
.account-row {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 6px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
}
.account-row strong {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-row .badge { flex-shrink: 0; }
.account-row .row-actions { display: flex; gap: 6px; margin-left: auto; flex-shrink: 0; }
.admin-content .card { width: min(720px, 100%); }
.desk { min-height: 100vh; background: #f3f6f8; color: #1f2937; }
.desk-top {
  height: 64px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid #e5ece8;
}
.desk-top .brand-icon { background: #128a6a; border-radius: 12px; }
.desk-id { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #4b5563; }
.desk-id span:first-child { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-badge { background: #e7f6f1; color: #128a6a; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; }
.ghost { border: 0; background: #f3f4f6; border-radius: 8px; padding: 6px 10px; font-size: 12px; }
.desk-actions { display: flex; justify-content: flex-end; gap: 8px; }
.desk-body { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: calc(100vh - 64px); }
.desk-nav { padding: 18px 12px; }
.desk-nav-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 0;
  background: transparent;
  color: #4b5563;
  padding: 11px 14px;
  border-radius: 12px;
  font-weight: 650;
  margin-bottom: 6px;
}
.desk-nav-item span { background: #e5e7eb; color: #374151; border-radius: 999px; min-width: 22px; text-align: center; font-size: 12px; padding: 1px 7px; }
.desk-nav-item.active { background: #e7f6f1; color: #128a6a; }
.desk-nav-item.active span { background: #cfeedf; color: #128a6a; }
.desk-main { padding: 22px 28px 40px; min-width: 0; }
.desk-heading { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 16px; }
.desk-heading h1 { margin: 0; font-size: 28px; }
.eyebrow { margin: 0 0 4px; color: #6b7280; font-size: 13px; }
.mail-cards { display: flex; flex-direction: column; gap: 12px; }
.mail-card {
  width: 100%;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 18px;
  gap: 10px;
  align-items: start;
  text-align: left;
  background: #eefaf4;
  border: 1px solid #d7eee4;
  border-radius: 16px;
  padding: 18px 16px;
}
.mail-card:hover { background: #e5f6ee; }
.dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; background: transparent; }
.dot.unread { background: #2563eb; }
.mail-card-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.mail-card-top h3 { margin: 0; font-size: 18px; line-height: 1.45; color: #111827; }
.mail-card-top time { color: #6b7280; font-size: 13px; white-space: nowrap; }
.mail-card .from { margin: 8px 0 6px; color: #4b5563; font-size: 14px; }
.mail-card .preview { margin: 0; color: #6b7280; font-size: 14px; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chevron { color: #9ca3af; font-size: 22px; line-height: 1; }
.read-card { background: #fff; border-radius: 16px; padding: 28px 32px 40px; margin-top: 14px; box-shadow: 0 8px 30px #0f172a08; }
.read-card h1 { font-size: 28px; margin: 0 0 18px; }
.read-meta { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 22px; color: #6b7280; }
.read-meta strong { display: block; color: #111827; font-size: 16px; }
.read-meta p { margin: 4px 0 0; }
.read-frame { width: 100%; min-height: 62vh; border: 0; background: #fff; }
.desk-more { padding: 18px 0; }
@media (max-width: 900px) {
  .desk-top { grid-template-columns: 1fr; height: auto; padding: 12px 16px; }
  .desk-body { grid-template-columns: 1fr; }
  .desk-id, .desk-actions { justify-content: flex-start; }
}
@media (max-width: 900px) {
  .mail-grid, .admin-grid, .admin-shell, .admin-app { grid-template-columns: 1fr; }
  .mail-list { max-height: 42vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-nav { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .nav-group { flex-direction: row; flex: 1; }
  .nav-logout { margin-top: 0; }
}
