/* 远辰智联企业邮箱管理系统 - 全站统一样式
   规范：纯方形直角、不对称版式、商务色系、无紫色、无渐变、无动画、无emoji */

:root {
  --bg: #edf0f4;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --ink: #1b2029;
  --ink-2: #3a424f;
  --muted: #737c8b;
  --line: #d8dde5;
  --line-2: #c2cad5;
  --navy: #16253d;
  --navy-2: #1d3151;
  --accent: #2a4b7c;
  --accent-2: #224069;
  --danger: #a32822;
  --ok: #1c6b4c;
  --warn: #976213;
  --shadow: 0 2px 10px rgba(22, 37, 61, 0.07);
}

*, *::before, *::after {
  box-sizing: border-box;
  border-radius: 0 !important;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { color: var(--accent-2); }

h1, h2, h3, h4, p { margin: 0; }

/* ========== 登录页 ========== */
.login-body {
  background: #e8ebef;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.login-wrap {
  flex: 1;
  display: grid;
  grid-template-columns: 1.18fr 0.82fr;
  min-height: calc(100vh - 112px);
}

.login-aside {
  background: var(--navy);
  color: #fff;
  padding: 76px 8% 60px 9%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.login-aside::before {
  content: "";
  position: absolute;
  right: -60px;
  top: 90px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.login-aside::after {
  content: "";
  position: absolute;
  right: 40px;
  top: 190px;
  width: 110px;
  height: 110px;
  background: rgba(255, 255, 255, 0.05);
}

.login-brand {
  position: relative;
  z-index: 2;
}
.login-brand-name {
  display: block;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 6px;
}
.login-brand-en {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 3px;
  color: #93a4bd;
}
.login-brand-line {
  width: 64px;
  height: 4px;
  background: #fff;
  margin-top: 26px;
}

.login-aside-main {
  position: relative;
  z-index: 2;
  max-width: 560px;
}
.login-aside-kicker {
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 5px 12px;
  font-size: 11px;
  letter-spacing: 2px;
  color: #c3cfe0;
}
.login-aside-title {
  font-size: 34px;
  line-height: 1.45;
  font-weight: 600;
  margin: 22px 0 18px;
}
.login-aside-desc {
  color: #9fb0c7;
  font-size: 14px;
  line-height: 2;
}

.login-aside-meta {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 24px;
}
.login-meta-item span {
  display: block;
  font-size: 11px;
  color: #8fa1ba;
  letter-spacing: 1px;
}
.login-meta-item strong {
  display: block;
  font-size: 15px;
  margin-top: 6px;
  font-weight: 500;
}

.login-panel {
  background: #fff;
  padding: 88px 9% 60px 9%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 1px solid var(--line);
}
.login-form-box {
  width: 100%;
  max-width: 420px;
}
.login-form-kicker {
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--muted);
}
.login-form-title {
  font-size: 26px;
  font-weight: 600;
  margin: 10px 0 6px;
  color: var(--ink);
}
.login-form-sub {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 36px;
}
.login-field { margin-bottom: 22px; }
.login-field label {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 9px;
  font-weight: 600;
}
.login-input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line-2);
  background: #fff;
  padding: 0 14px;
  font-size: 14px;
  color: var(--ink);
  outline: none;
}
.login-input:focus {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.login-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 26px;
}
.login-role-note {
  font-size: 12px;
  color: var(--muted);
}
.login-btn {
  width: 100%;
  height: 50px;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #fff;
  font-size: 15px;
  letter-spacing: 2px;
  cursor: pointer;
  font-weight: 600;
}
.login-btn:hover { background: var(--navy-2); }
.login-tip {
  margin-top: 24px;
  border-left: 3px solid var(--accent);
  background: var(--panel-2);
  padding: 14px 16px;
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.9;
}
.login-tip strong { color: var(--ink); }

/* ========== 应用框架 ========== */
.app-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-shell {
  flex: 1;
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: calc(100vh - 96px);
}
.side {
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 0 0 22px;
}
.side-brand {
  padding: 28px 22px 26px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.brand-mark {
  display: block;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 3px;
}
.brand-sub {
  display: block;
  font-size: 10px;
  letter-spacing: 2px;
  color: #8fa1ba;
  margin-top: 6px;
}
.side-section-label {
  font-size: 11px;
  color: #8497b1;
  letter-spacing: 2px;
  padding: 24px 22px 10px;
}
.side-nav {
  display: flex;
  flex-direction: column;
}
.side-link {
  display: block;
  padding: 12px 22px;
  color: #c5d1e0;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.side-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.side-link.active {
  background: var(--navy-2);
  border-left-color: #fff;
  color: #fff;
  font-weight: 600;
}
.side-foot {
  margin-top: auto;
  padding: 20px 22px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.side-foot-label { font-size: 11px; color: #8497b1; letter-spacing: 1px; }
.side-foot-token { font-family: Consolas, monospace; font-size: 12px; margin-top: 8px; color: #c5d1e0; }
.side-foot-note { font-size: 11px; color: #6f83a0; margin-top: 8px; line-height: 1.7; }

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  height: 66px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
}
.topbar-left { display: flex; align-items: baseline; gap: 14px; }
.topbar-kicker { font-size: 10px; letter-spacing: 2px; color: var(--muted); }
.topbar-title { font-size: 17px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-role {
  font-size: 12px;
  border: 1px solid var(--line-2);
  padding: 4px 10px;
  color: var(--ink-2);
}
.topbar-user { font-size: 13px; color: var(--ink-2); }
.topbar-exit {
  font-size: 13px;
  padding: 7px 14px;
  border: 1px solid var(--line-2);
  color: var(--ink-2);
}
.topbar-exit:hover { border-color: var(--danger); color: var(--danger); }

.content {
  padding: 28px 30px 40px;
  flex: 1;
}

/* ========== 通用组件 ========== */
.notice {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line-2);
  background: #fff;
  margin-bottom: 20px;
  font-size: 13px;
}
.notice-label {
  padding: 11px 16px;
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
}
.notice > span:last-child { padding: 11px 16px; color: var(--ink-2); }
.notice-error { border-color: #d9aaa6; }
.notice-error .notice-label { background: var(--danger); }
.notice-ok { border-color: #a8cdbc; }
.notice-ok .notice-label { background: var(--ok); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-sub { font-size: 12px; color: var(--muted); }
.card-body { padding: 20px; }

.grid-stats {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 0.9fr;
  gap: 16px;
  margin-bottom: 20px;
}
.stat {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
.stat-label { font-size: 12px; color: var(--muted); letter-spacing: 1px; }
.stat-value { font-size: 30px; font-weight: 600; margin-top: 10px; line-height: 1.1; }
.stat-note { font-size: 11px; color: var(--muted); margin-top: 10px; border-top: 1px solid var(--line); padding-top: 9px; }
.stat.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.stat.primary .stat-label, .stat.primary .stat-note { color: #a9b9cf; }
.stat.primary .stat-note { border-top-color: rgba(255, 255, 255, 0.18); }

.split {
  display: grid;
  grid-template-columns: 1.65fr 0.85fr;
  gap: 20px;
  align-items: start;
}
.split-reverse {
  display: grid;
  grid-template-columns: 0.9fr 1.6fr;
  gap: 20px;
  align-items: start;
}

.btn {
  display: inline-block;
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--ink-2);
  padding: 9px 17px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn-dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-dark:hover { background: var(--navy-2); color: #fff; }
.btn-danger { color: var(--danger); border-color: #d9aaa6; }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-block { width: 100%; text-align: center; }

input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  border: 1px solid var(--line-2);
  background: #fff;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--ink);
  font-family: inherit;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
textarea { resize: vertical; min-height: 120px; line-height: 1.8; }
label.field-label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; font-weight: 600; }
.field { margin-bottom: 18px; }
.field-hint { font-size: 11px; color: var(--muted); margin-top: 6px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.toolbar .spacer { flex: 1; }
.toolbar input[type="search"], .toolbar select { width: auto; min-width: 170px; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th {
  text-align: left;
  background: #f2f4f7;
  color: var(--ink-2);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td {
  padding: 13px 16px;
  border-bottom: 1px solid #e8ebef;
  vertical-align: middle;
  color: var(--ink-2);
}
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #fafbfc; }
.table-wrap { overflow-x: auto; }

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  background: #fff;
}
.tag-ok { border-color: #a8cdbc; color: var(--ok); }
.tag-off { border-color: #d9aaa6; color: var(--danger); }
.tag-admin { border-color: #a9b9cf; color: var(--navy); }
.tag-warn { border-color: #dcc79f; color: var(--warn); }

.pager {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
}
.pager-btn {
  border: 1px solid var(--line-2);
  padding: 6px 14px;
  font-size: 12px;
  color: var(--ink-2);
}
.pager-btn:hover { border-color: var(--accent); color: var(--accent); }
.pager-btn.disabled { opacity: 0.4; pointer-events: none; }
.pager-info { font-size: 12px; color: var(--muted); }

.empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.empty strong { display: block; color: var(--ink-2); font-size: 15px; margin-bottom: 8px; }

/* ========== 邮件列表 ========== */
.mail-layout {
  display: grid;
  grid-template-columns: 1.62fr 0.88fr;
  gap: 20px;
  align-items: start;
}
.mail-list { list-style: none; margin: 0; padding: 0; }
.mail-item {
  display: grid;
  grid-template-columns: 20px 1fr 150px 74px;
  gap: 12px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid #e8ebef;
  font-size: 13px;
}
.mail-item:last-child { border-bottom: none; }
.mail-item:hover { background: #fafbfc; }
.mail-item.unread { background: #f5f8fc; }
.mail-check { width: 15px; height: 15px; accent-color: var(--accent); }
.mail-subject { color: var(--ink); font-weight: 500; }
.mail-item.unread .mail-subject { font-weight: 700; }
.mail-subject a { color: var(--ink); }
.mail-subject a:hover { color: var(--accent); }
.mail-from { font-size: 11px; color: var(--muted); margin-top: 5px; }
.mail-time { color: var(--muted); font-size: 12px; text-align: right; }
.mail-actions { text-align: right; white-space: nowrap; }

.mail-detail-head { border-bottom: 1px solid var(--line); padding-bottom: 18px; margin-bottom: 20px; }
.mail-detail-title { font-size: 20px; font-weight: 600; line-height: 1.5; }
.mail-detail-meta { margin-top: 14px; font-size: 12px; color: var(--muted); line-height: 2; }
.mail-detail-meta strong { color: var(--ink-2); font-weight: 600; }
.mail-detail-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 2;
  color: var(--ink-2);
  min-height: 180px;
}
.mail-detail-actions { display: flex; flex-wrap: wrap; gap: 10px; border-top: 1px solid var(--line); padding-top: 18px; margin-top: 22px; }

.compose-grid { display: grid; grid-template-columns: 1.5fr 0.85fr; gap: 20px; align-items: start; }
.kv-list { margin: 0; }
.kv-row { display: flex; border-bottom: 1px solid #e8ebef; font-size: 13px; }
.kv-row:last-child { border-bottom: none; }
.kv-key { width: 118px; flex-shrink: 0; padding: 12px 16px; background: #f7f8fa; color: var(--muted); }
.kv-val { padding: 12px 16px; color: var(--ink-2); word-break: break-all; }

.def-list { display: grid; grid-template-columns: 1fr; }
.def-row { display: flex; justify-content: space-between; gap: 20px; padding: 11px 0; border-bottom: 1px solid #e8ebef; font-size: 13px; }
.def-row:last-child { border-bottom: none; }
.def-row span:first-child { color: var(--muted); }
.def-row span:last-child { color: var(--ink-2); text-align: right; font-weight: 600; word-break: break-all; }

/* ========== 弹窗 ========== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 26, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 90;
  padding: 20px;
}
.modal-mask.open { display: flex; }
.modal {
  background: #fff;
  border: 1px solid var(--line-2);
  width: 100%;
  max-width: 560px;
  box-shadow: 0 10px 40px rgba(10, 20, 35, 0.22);
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close { border: 1px solid var(--line-2); background: var(--panel-2); font-size: 12px; padding: 5px 10px; cursor: pointer; color: var(--ink-2); line-height: 1; }
.modal-body { padding: 22px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: var(--panel-2); }

/* 紧凑版式 */
.density-compact .content { padding: 18px 22px 28px; }
.density-compact .card-body { padding: 14px 16px; }
.density-compact .card-head { padding: 12px 16px; }
.density-compact table.data th, .density-compact table.data td { padding: 9px 12px; }
.density-compact .mail-item { padding: 10px 16px; }
.density-compact .field { margin-bottom: 12px; }

/* ========== 页脚 ========== */
.site-footer {
  display: grid;
  grid-template-columns: 0.9fr 2.5fr 1.1fr;
  min-height: 96px;
  border-top: 1px solid #0e1a2c;
  color: #b6c3d5;
  font-size: 12px;
}
.footer-cell { padding: 24px 30px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.footer-brand { background: #101d30; }
.footer-brand-name { color: #fff; font-size: 16px; font-weight: 700; letter-spacing: 2px; }
.footer-brand-en { font-size: 10px; letter-spacing: 2px; color: #71839c; }
.footer-copy { background: #16253d; border-left: 1px solid rgba(255, 255, 255, 0.08); }
.footer-copy span { line-height: 1.9; }
.footer-tech { background: #1c2e4b; border-left: 1px solid rgba(255, 255, 255, 0.08); }
.footer-tech span { font-family: Consolas, monospace; font-size: 11px; color: #9fb0c7; }

/* ========== 响应式 ========== */
@media (max-width: 1100px) {
  .grid-stats { grid-template-columns: 1fr 1fr; }
  .split, .split-reverse, .mail-layout, .compose-grid { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 14px; }
  .side-brand { padding: 6px 14px; border-bottom: none; }
  .side-section-label, .side-foot { display: none; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-link { padding: 8px 12px; border-left: none; border-bottom: 3px solid transparent; }
  .side-link.active { border-left: none; border-bottom-color: #fff; }
  .topbar { padding: 0 16px; }
  .topbar-role, .topbar-kicker { display: none; }
  .content { padding: 20px 16px 32px; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-aside { padding: 46px 24px; }
  .login-aside-title { font-size: 26px; }
  .login-panel { padding: 44px 24px; border-left: none; border-top: 1px solid var(--line); }
  .site-footer { grid-template-columns: 1fr; }
  .footer-cell { padding: 18px 20px; }
  .mail-item { grid-template-columns: 20px 1fr 90px; }
  .mail-actions { display: none; }
}
