/* ============================================================
   创邦邮箱 · 新拟态 (Neumorphism) 设计系统
   温润 · 高级 · 现代专业。light / dark 双主题。
   ============================================================ */
:root {
  --bg: #e8ecf3;
  --surface: #e8ecf3;
  --sh-light: #ffffff;
  --sh-dark: #c3cad8;
  --text: #44506a;
  --muted: #8b94a8;
  --line: #d4dae6;
  --accent: #5b7cfa;
  --accent-soft: #e3e9ff;
  --accent-text: #3a5bd9;
  --ok: #2bb98a;
  --ok-soft: #dcf5ec;
  --warn: #f0a23b;
  --warn-soft: #fdecd6;
  --danger: #ef5d6b;
  --danger-soft: #fce0e3;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --r-shadow: 8px 8px 18px var(--sh-dark), -8px -8px 18px var(--sh-light);
  --r-shadow-sm: 5px 5px 11px var(--sh-dark), -5px -5px 11px var(--sh-light);
  --inset: inset 6px 6px 12px var(--sh-dark), inset -6px -6px 12px var(--sh-light);
  --inset-sm: inset 4px 4px 8px var(--sh-dark), inset -4px -4px 8px var(--sh-light);
  --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Consolas", ui-monospace, monospace;
}
[data-theme="dark"] {
  --bg: #2a2e3d;
  --surface: #2a2e3d;
  --sh-light: #353a4d;
  --sh-dark: #1f2230;
  --text: #d9deea;
  --muted: #8b93a8;
  --line: #353a4d;
  --accent: #7d97ff;
  --accent-soft: #31374d;
  --accent-text: #aebcff;
  --ok: #46c79b;
  --ok-soft: #2c3a37;
  --warn: #f2b15c;
  --warn-soft: #3a3326;
  --danger: #f57984;
  --danger-soft: #3a2a2d;
  --r-shadow: 8px 8px 18px var(--sh-dark), -8px -8px 18px var(--sh-light);
  --r-shadow-sm: 5px 5px 11px var(--sh-dark), -5px -5px 11px var(--sh-light);
  --inset: inset 6px 6px 12px var(--sh-dark), inset -6px -6px 12px var(--sh-light);
  --inset-sm: inset 4px 4px 8px var(--sh-dark), inset -4px -4px 8px var(--sh-light);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

/* ---------- 布局 ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex: 0 0 248px;
  background: var(--surface);
  box-shadow: var(--r-shadow);
  border-radius: var(--radius-lg);
  margin: 18px 0 18px 18px; padding: 22px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 18px; }
.brand .logo {
  width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px;
  background: linear-gradient(135deg, var(--accent), #8a6bff);
  box-shadow: var(--r-shadow-sm);
}
.brand .name { font-weight: 700; font-size: 16px; letter-spacing: .3px; }
.brand .sub { font-size: 11px; color: var(--muted); }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  color: var(--text); cursor: pointer; border: none; background: transparent;
  font-size: 14px; font-family: var(--font); text-align: left; width: 100%;
  transition: .18s;
}
.nav-item .ico { width: 20px; text-align: center; opacity: .8; }
.nav-item:hover { box-shadow: var(--r-shadow-sm); }
.nav-item.active { box-shadow: var(--inset-sm); color: var(--accent-text); font-weight: 600; }
.nav-item.active .ico { opacity: 1; }
.sidebar .spacer { flex: 1; }
.sidebar .me {
  box-shadow: var(--inset-sm); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 12px; color: var(--muted);
}
.sidebar .me b { color: var(--text); display: block; font-size: 13px; }

.main { flex: 1; padding: 24px 28px; overflow: auto; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px; gap: 16px;
}
.topbar h1 { font-size: 22px; font-weight: 700; }
.topbar .tools { display: flex; gap: 10px; align-items: center; }

/* ---------- 新拟态基元 ---------- */
.neu { background: var(--surface); box-shadow: var(--r-shadow); border-radius: var(--radius); }
.neu-inset { background: var(--surface); box-shadow: var(--inset); border-radius: var(--radius); }
.card { background: var(--surface); box-shadow: var(--r-shadow); border-radius: var(--radius); padding: 20px; }
.card.pad-lg { padding: 26px; }
.card h2 { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.card .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

.btn {
  font-family: var(--font); font-size: 14px; cursor: pointer;
  border: none; border-radius: var(--radius-sm); padding: 11px 18px;
  background: var(--surface); color: var(--text); box-shadow: var(--r-shadow-sm);
  transition: .16s; display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { box-shadow: var(--r-shadow); }
.btn:active { box-shadow: var(--inset-sm); }
.btn.primary { color: #fff; background: linear-gradient(135deg, var(--accent), #8a6bff); box-shadow: var(--r-shadow-sm); }
.btn.primary:active { box-shadow: var(--inset-sm); }
.btn.ghost { box-shadow: none; color: var(--muted); }
.btn.ghost:hover { box-shadow: var(--r-shadow-sm); color: var(--text); }
.btn.sm { padding: 8px 13px; font-size: 13px; border-radius: 10px; }
.btn.xs { padding: 5px 10px; font-size: 12px; border-radius: 9px; }
.btn.danger { color: #fff; background: linear-gradient(135deg, var(--danger), #d8455a); box-shadow: var(--r-shadow-sm); }
.btn.danger:active { box-shadow: var(--inset-sm); }
.acts { white-space: nowrap; }
.acts .btn { margin-right: 6px; }
.acts .btn:last-child { margin-right: 0; }

.input, .select, textarea.input {
  width: 100%; font-family: var(--font); font-size: 14px; color: var(--text);
  background: var(--surface); border: none; border-radius: var(--radius-sm);
  box-shadow: var(--inset-sm); padding: 12px 16px; outline: none; transition: .16s;
}
.input::placeholder { color: var(--muted); }
.input:focus { box-shadow: var(--inset); }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; padding-left: 4px; }

/* ---------- 徽章 / 标签 ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 5px 11px; border-radius: 999px; box-shadow: var(--r-shadow-sm); }
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.badge.danger { color: var(--danger); }
.badge.muted { color: var(--muted); }
.badge.accent { color: var(--accent-text); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.danger { background: var(--danger); }
.dot.muted { background: var(--muted); }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 600;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(128,140,170,.06); }
.table .num { font-family: var(--mono); }

/* ---------- 统计卡 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; }
.stat { background: var(--surface); box-shadow: var(--r-shadow); border-radius: var(--radius); padding: 20px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 30px; font-weight: 700; margin-top: 6px; font-family: var(--mono); }
.stat .v small { font-size: 13px; color: var(--muted); font-weight: 500; }

/* ---------- 邮件列表项 ---------- */
.mail-list { display: flex; flex-direction: column; gap: 12px; }
.mail-item {
  background: var(--surface); box-shadow: var(--r-shadow-sm); border-radius: var(--radius-sm);
  padding: 14px 18px; cursor: pointer; transition: .16s; display: flex; gap: 14px; align-items: flex-start;
}
.mail-item:hover { box-shadow: var(--r-shadow); }
.mail-item.unread { box-shadow: var(--r-shadow-sm); }
.mail-item.unread .m-subject { font-weight: 700; }
.m-avatar {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 700; box-shadow: var(--inset-sm);
}
.m-body { flex: 1; min-width: 0; }
.m-line1 { display: flex; justify-content: space-between; gap: 12px; }
.m-from { font-weight: 600; color: var(--text); }
.m-date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.m-subject { font-size: 13.5px; margin: 3px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-preview { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-chip {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--ok);
  background: var(--ok-soft); padding: 5px 12px; border-radius: 10px;
}

/* ---------- 验证码高亮卡 ---------- */
.code-hero { background: var(--surface); box-shadow: var(--r-shadow); border-radius: var(--radius-lg); padding: 26px; text-align: center; }
.code-hero .label { color: var(--muted); font-size: 13px; }
.code-hero .code { font-family: var(--mono); font-size: 46px; font-weight: 700; color: var(--accent-text); letter-spacing: 6px; margin: 10px 0; }
.code-hero .from { font-size: 12px; color: var(--muted); }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 380px; max-width: 100%; background: var(--surface); box-shadow: var(--r-shadow); border-radius: var(--radius-lg); padding: 38px 32px; }
.login-card .logo { width: 56px; height: 56px; margin: 0 auto 16px; }
.login-card h1 { text-align: center; font-size: 20px; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.login-err { color: var(--danger); font-size: 13px; text-align: center; margin-top: 14px; min-height: 18px; }

/* ---------- 杂项 ---------- */
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > .col { flex: 1; min-width: 240px; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tab { padding: 9px 16px; border-radius: 999px; cursor: pointer; font-size: 13px; color: var(--muted); background: var(--surface); box-shadow: var(--r-shadow-sm); border: none; font-family: var(--font); }
.tab.active { box-shadow: var(--inset-sm); color: var(--accent-text); font-weight: 600; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .input { width: auto; flex: 1; min-width: 180px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface); box-shadow: var(--r-shadow); border-radius: 14px; padding: 12px 20px;
  font-size: 13px; color: var(--text); opacity: 0; pointer-events: none; transition: .25s; z-index: 99;
}
.toast.show { opacity: 1; bottom: 32px; }
.kbd { font-family: var(--mono); background: var(--surface); box-shadow: var(--inset-sm); padding: 1px 7px; border-radius: 6px; font-size: 12px; }
.dns-card { font-family: var(--mono); font-size: 12.5px; line-height: 1.9; }
.dns-card .k { color: var(--muted); }
.theme-toggle { cursor: pointer; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .app-shell { flex-direction: column; }
  .main { padding: 16px; }
}
