/* maild — Material 3 风格浅色主题
   设计要点：圆角卡片、柔和阴影、胶囊按钮、彩色头像、图标化操作。 */

:root {
  --p: #4f46e5;
  --p-hover: #4338ca;
  --p-soft: #eef0ff;
  --p-soft-2: #dfe2ff;

  --ink: #17181d;
  --ink-2: #5a5f70;
  --ink-3: #9096a8;

  --line: #e7e9f2;
  --line-soft: #f0f1f7;
  --bg: #f6f7fb;
  --card: #ffffff;

  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #0f9d68;
  --ok-soft: #e7f6ef;
  --warn: #d97706;
  --warn-soft: #fff4e5;

  --r-xl: 24px;
  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 10px;

  --sh-1: 0 1px 2px rgba(23, 24, 29, .04), 0 3px 10px rgba(23, 24, 29, .045);
  --sh-2: 0 2px 8px rgba(23, 24, 29, .06), 0 16px 36px rgba(23, 24, 29, .07);
  --ring: 0 0 0 4px rgba(79, 70, 229, .13);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--p-soft-2); }

/* ---------- 图标 ---------- */

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.i {
  width: 20px; height: 20px;
  fill: currentColor;
  flex: none;
  vertical-align: -4px;
}
.i.sm { width: 16px; height: 16px; vertical-align: -3px; }
.i.lg { width: 26px; height: 26px; }
.i.xl { width: 34px; height: 34px; }

/* ---------- 顶栏 ---------- */

.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 11px 22px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
  font-weight: 650; font-size: 15px; letter-spacing: -.01em;
  flex: none;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  box-shadow: 0 3px 10px rgba(99, 102, 241, .35);
}
.brand-mark .i { width: 19px; height: 19px; vertical-align: 0; }

.nav {
  display: flex; align-items: center; gap: 4px;
  flex: 1; min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav-item {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px;
  border-radius: 999px;
  color: var(--ink-2); text-decoration: none;
  font-size: 14px; font-weight: 500;
  white-space: nowrap;
  transition: background .16s, color .16s;
}
.nav-item:hover { background: var(--line-soft); color: var(--ink); text-decoration: none; }
.nav-item.on { background: var(--p-soft); color: var(--p); font-weight: 650; }
.nav-item .i { width: 18px; height: 18px; }

.user { display: flex; align-items: center; gap: 9px; flex: none; }
.user-name {
  font-size: 13px; color: var(--ink-2); font-weight: 500;
  max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 头像 ---------- */

.avatar {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; flex: none;
  border-radius: 50%;
  font-size: 15px; font-weight: 650;
  letter-spacing: 0;
  background: var(--p-soft); color: var(--p);
  user-select: none;
}
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 21px; }

/* 列表里按位置轮换配色，避免整屏同色 */
tr:nth-child(6n+1) .avatar, li:nth-child(6n+1) .avatar { background: #eef0ff; color: #4f46e5; }
tr:nth-child(6n+2) .avatar, li:nth-child(6n+2) .avatar { background: #e7f6ef; color: #0f9d68; }
tr:nth-child(6n+3) .avatar, li:nth-child(6n+3) .avatar { background: #fff2e6; color: #c2680a; }
tr:nth-child(6n+4) .avatar, li:nth-child(6n+4) .avatar { background: #fdeef3; color: #db2777; }
tr:nth-child(6n+5) .avatar, li:nth-child(6n+5) .avatar { background: #e8f3ff; color: #0284c7; }
tr:nth-child(6n+6) .avatar, li:nth-child(6n+6) .avatar { background: #f1eefe; color: #7c3aed; }

/* ---------- 主体 ---------- */

main {
  max-width: 940px;
  margin: 0 auto;
  padding: 26px 22px 72px;
}

main > * { animation: rise .34s cubic-bezier(.2, .7, .3, 1) both; }
main > *:nth-child(2) { animation-delay: .04s; }
main > *:nth-child(3) { animation-delay: .08s; }
main > *:nth-child(4) { animation-delay: .12s; }
main > *:nth-child(5) { animation-delay: .16s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  main > * { animation: none; }
  * { transition: none !important; }
}

/* ---------- 提示条 ---------- */

.flash, .err {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px;
  border-radius: var(--r-lg);
  font-size: 14px; font-weight: 500;
  margin-bottom: 16px;
}
.flash { background: var(--ok-soft); color: #0a7a51; }
.err { background: var(--danger-soft); color: #b91c1c; }
.flash .i, .err .i { width: 19px; height: 19px; }

/* ---------- 卡片 ---------- */

.card {
  background: var(--card);
  border-radius: var(--r-xl);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--sh-1);
}
.card.tight { padding: 8px 10px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.card-head > .lead { display: flex; align-items: center; gap: 14px; min-width: 0; }

/* ---------- 排版 ---------- */

h1 {
  font-size: 21px; font-weight: 680; letter-spacing: -.015em;
  margin: 0 0 14px; line-height: 1.35;
}
h2 {
  font-size: 14px; font-weight: 650; color: var(--ink-2);
  margin: 0 0 14px; letter-spacing: .005em;
  display: flex; align-items: center; gap: 8px;
}
h2 .i { width: 17px; height: 17px; color: var(--ink-3); }
h1.mono, h2.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

.muted { color: var(--ink-2); font-size: 13px; line-height: 1.65; }
.dim { color: var(--ink-3); }
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
  font-size: .95em;
}
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }

/* ---------- 表单 ---------- */

label {
  display: block;
  font-size: 12.5px; font-weight: 600;
  color: var(--ink-2);
  margin: 16px 0 6px;
  letter-spacing: .01em;
}
label:first-of-type { margin-top: 0; }

input[type=text], input[type=password], input[type=email], select {
  width: 100%;
  padding: 12px 15px;
  font: inherit; font-size: 15px;
  color: var(--ink);
  background: #f4f5fa;
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  transition: background .16s, border-color .16s, box-shadow .16s;
  appearance: none;
}
input::placeholder { color: var(--ink-3); }
input:hover { background: #eff0f7; }
input:focus {
  outline: none;
  background: #fff;
  border-color: var(--p);
  box-shadow: var(--ring);
}

/* 输入框尾部域名后缀 */
.ig { position: relative; display: block; }
.ig input { padding-right: 15px; }
.ig.has-suffix input { padding-right: 15px; }
.ig-suffix {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-size: 13px; color: var(--ink-3);
  pointer-events: none; white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- 按钮 ---------- */

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 19px;
  font: inherit; font-size: 14px; font-weight: 550;
  line-height: 1.4;
  color: var(--ink);
  background: var(--line-soft);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background .16s, box-shadow .16s, transform .12s, color .16s;
}
button:hover, .btn:hover { background: #e9ebf3; text-decoration: none; }
button:active, .btn:active { transform: scale(.975); }
button:focus-visible, .btn:focus-visible { outline: none; box-shadow: var(--ring); }
button .i, .btn .i { width: 18px; height: 18px; }

button.primary, .btn.primary {
  background: var(--p); color: #fff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, .3);
}
button.primary:hover, .btn.primary:hover {
  background: var(--p-hover);
  box-shadow: 0 4px 14px rgba(79, 70, 229, .38);
}

button.danger {
  background: var(--danger-soft); color: #b91c1c;
}
button.danger:hover { background: #fde8e8; }

button.ghost {
  background: transparent; color: var(--ink-2);
  padding: 9px 14px;
}
button.ghost:hover { background: var(--line-soft); color: var(--ink); }

/* 圆形图标按钮 */
.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  border-radius: 50%;
  background: transparent; color: var(--ink-3);
  flex: none;
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn .i { width: 18px; height: 18px; }

button.block { width: 100%; }

.inline { display: inline; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

/* ---------- 表格 / 列表 ---------- */

/* 表格在窄容器里横向滚动，避免撑破页面 */
.card:has(> table) { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
th {
  color: var(--ink-3); font-weight: 600; font-size: 11.5px;
  letter-spacing: .04em; text-transform: uppercase;
  padding-top: 8px; padding-bottom: 8px;
}
tbody tr { transition: background .13s; }
tbody tr:hover { background: #fafbff; }
tr:last-child td { border-bottom: none; }

td.act { text-align: right; white-space: nowrap; }
td.act form { display: inline; }

.list { list-style: none; padding: 0; margin: 0; }
.list > li {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 10px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .13s;
}
.list > li:last-child { border-bottom: none; }
.list > li:hover { background: #fafbff; }
.list .grow { flex: 1; min-width: 0; }

/* ---------- 邮件列表 ---------- */

.mail-table td.sender { white-space: nowrap; }
.mail-table .subj-cell { min-width: 0; }
.mail-table .subj-cell a {
  color: var(--ink); text-decoration: none;
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mail-table .subj-cell a:hover { color: var(--p); }
.mail-table tr.unread .subj-cell a { font-weight: 650; }
.mail-table tr.unread .sender-name { font-weight: 650; color: var(--ink); }
.mail-table .sender-name { color: var(--ink-2); font-size: 13.5px; }
.mail-table .when { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; text-align: right; }

.dot {
  display: inline-block; width: 7px; height: 7px;
  border-radius: 50%; background: var(--p);
  flex: none;
}

/* ---------- 标签 ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--line-soft); color: var(--ink-2);
  white-space: nowrap;
}
.pill .i { width: 13px; height: 13px; }
.pill.temp { background: var(--p-soft); color: var(--p); }
.pill.warn { background: var(--warn-soft); color: #b45309; }
.pill.bad { background: var(--danger-soft); color: #b91c1c; }
.pill.ok { background: var(--ok-soft); color: #0a7a51; }

/* ---------- 邮箱切换 ---------- */

.chips {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--sh-1);
  color: var(--ink-2); text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  transition: background .16s, color .16s, box-shadow .16s;
}
.chip:hover { color: var(--ink); box-shadow: var(--sh-2); text-decoration: none; }
.chip.on {
  background: var(--p); color: #fff;
  box-shadow: 0 3px 12px rgba(79, 70, 229, .32);
}
.chip.add { border: 1.5px dashed var(--line); box-shadow: none; background: transparent; }
.chip.add:hover { border-color: var(--p); color: var(--p); background: var(--p-soft); }
.chip .i { width: 16px; height: 16px; }

/* ---------- 进度条 ---------- */

.bar {
  height: 6px; border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
  margin-top: 9px;
}
.bar > i {
  display: block; height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  transition: width .4s cubic-bezier(.2, .7, .3, 1);
}
.bar.warn > i { background: linear-gradient(90deg, #f59e0b, #ef4444); }

/* ---------- 读信 ---------- */

.msg-head { padding-bottom: 16px; margin-bottom: 18px; border-bottom: 1px solid var(--line-soft); }
.msg-head h1 { font-size: 20px; margin: 0 0 16px; }

.msg-meta { display: flex; align-items: center; gap: 13px; }
.msg-meta .grow { flex: 1; min-width: 0; }
.msg-meta .from { font-weight: 600; font-size: 14.5px; }
.msg-meta .to { color: var(--ink-2); font-size: 12.5px; margin-top: 1px; }

.msg-facts {
  display: flex; gap: 18px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px dashed var(--line);
  font-size: 12.5px; color: var(--ink-2);
}
.msg-facts > span { display: inline-flex; align-items: center; gap: 6px; }
.msg-facts .i { width: 15px; height: 15px; color: var(--ink-3); }

.attachments {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.att {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  background: var(--line-soft);
  border-radius: 999px;
  font-size: 12.5px; color: var(--ink-2);
  max-width: 100%;
}
.att .i { width: 15px; height: 15px; color: var(--ink-3); flex: none; }
.att span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.body-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--ink);
  max-height: 70vh;
  overflow: auto;
}

iframe.mail {
  width: 100%; min-height: 460px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: #fff;
  display: block;
}

/* ---------- 空状态 ---------- */

.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.7;
}
.empty .ring {
  width: 62px; height: 62px;
  margin: 0 auto 16px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--p-soft);
  color: var(--p);
}
.empty .ring .i { width: 28px; height: 28px; }
.empty .big { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }

/* ---------- 登录 / 注册 ---------- */

.auth {
  max-width: 420px;
  margin: 6vh auto 0;
}
.auth-card {
  background: var(--card);
  border-radius: 28px;
  padding: 34px 32px 30px;
  box-shadow: var(--sh-2);
}
.auth-logo {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  border-radius: 17px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  box-shadow: 0 6px 20px rgba(99, 102, 241, .38);
  margin-bottom: 20px;
}
.auth-logo .i { width: 28px; height: 28px; vertical-align: 0; }
.auth-card h1 { font-size: 23px; margin-bottom: 6px; }
.auth-sub { color: var(--ink-2); font-size: 13.5px; margin-bottom: 24px; line-height: 1.65; }
.auth-foot {
  margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px; color: var(--ink-2);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap;
}
.auth-foot a { color: var(--p); font-weight: 600; text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }

.hint-box {
  display: flex; gap: 10px;
  padding: 12px 15px;
  background: var(--p-soft);
  border-radius: var(--r-md);
  font-size: 12.5px; color: #4338ca;
  line-height: 1.6;
  margin-bottom: 20px;
}
.hint-box .i { width: 16px; height: 16px; flex: none; margin-top: 2px; }

/* ---------- 页脚 ---------- */

.foot {
  text-align: center;
  color: var(--ink-3);
  font-size: 12px;
  padding: 8px 0 40px;
  letter-spacing: .01em;
}

/* ---------- 窄屏 ---------- */

@media (max-width: 680px) {
  .appbar { padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
  .brand-text { display: none; }
  .user-name { display: none; }
  .nav { order: 3; width: 100%; }
  .nav-item { padding: 7px 13px; font-size: 13.5px; }
  main { padding: 18px 14px 60px; }
  .card { border-radius: var(--r-lg); padding: 16px 16px; }
  .auth-card { padding: 26px 22px 24px; border-radius: 24px; }
  .auth { margin-top: 3vh; }
  h1 { font-size: 19px; }
  /* 手机上收件箱只留 发件人 / 主题 / 删除，隐藏头像列与时间列（第 1、4 列） */
  .mail-table { table-layout: fixed; }
  .mail-table th:nth-child(1), .mail-table td:nth-child(1) { display: none; }
  .mail-table th:nth-child(4), .mail-table td:nth-child(4) { display: none; }
  .mail-table th:nth-child(2), .mail-table td:nth-child(2) { width: 38%; }
  .mail-table th:nth-child(5), .mail-table td:nth-child(5) { width: 40px; }
  .mail-table th, .mail-table td { padding: 11px 6px; }
  .msg-facts { gap: 12px; }
  iframe.mail { min-height: 340px; }
}
