:root {
  --gold-1: #F6D48A;
  --gold-2: #C8892A;
  --gold: #E3B04B;
  --gold-deep: #B8801F;
  --gold-soft: #FBF3E0;
  --gold-line: #F0E2C0;
  --ink: #232B36;
  --ink-2: #5A6572;
  --ink-3: #9099A6;
  --bg: #F6F4EF;
  --card: #FFFFFF;
  --line: #ECE6DA;
  --danger: #D9534F;
  --ok: #3E9B62;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(35, 43, 54, .06);
  --shadow: 0 6px 20px rgba(35, 43, 54, .08);
  --shadow-lg: 0 24px 60px rgba(35, 43, 54, .18);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }

/* --------------------------- 通用控件 --------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 9px;
  border: 1px solid transparent; background: transparent;
  font-size: 13.5px; font-weight: 500; color: var(--ink);
  transition: .16s ease;
}
.btn-primary {
  background: linear-gradient(135deg, var(--gold-1), var(--gold-2));
  color: #3A2B08; font-weight: 600;
  box-shadow: 0 4px 12px rgba(200, 137, 42, .28);
}
.btn-primary:hover { filter: brightness(1.04); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { border-color: var(--line); background: #fff; color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--gold-line); background: var(--gold-soft); color: var(--gold-deep); }
.btn-block { width: 100%; height: 42px; justify-content: center; font-size: 15px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none !important; }

.mini-btn {
  width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 15px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.mini-btn:hover { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold-deep); }
.mini-select {
  height: 28px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  color: var(--ink-2); padding: 0 6px; font-size: 12.5px;
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.field input, .field select, .field textarea {
  height: 38px; border-radius: 9px; border: 1px solid var(--line); background: #fff;
  padding: 0 12px; outline: none; transition: .16s;
}
.field textarea { height: auto; padding: 10px 12px; line-height: 1.65; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--gold); box-shadow: 0 0 0 3px rgba(227, 176, 75, .16);
}
.field.checkline { flex-direction: row; align-items: center; gap: 8px; padding-top: 22px; }
.field.checkline span { font-size: 13px; color: var(--ink-2); }
.field.checkline.top-gap { padding-top: 4px; margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1.4fr .8fr auto; gap: 14px; align-items: end; }
.section-label {
  font-size: 12px; font-weight: 700; color: var(--gold-deep); letter-spacing: .06em;
  margin: 6px 0 10px; padding-left: 9px; border-left: 3px solid var(--gold); text-transform: uppercase;
}
.hint { font-size: 12px; color: var(--ink-3); line-height: 1.5; }
.spacer { flex: 1; }

/* --------------------------- 登录页 --------------------------- */
.login-view { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
.login-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(1100px 520px at 12% -10%, #FBEBC7 0%, rgba(251, 235, 199, 0) 62%),
    radial-gradient(900px 480px at 96% 6%, #F3DCAE 0%, rgba(243, 220, 174, 0) 60%),
    linear-gradient(140deg, #FFFDF7 0%, #F7F1E4 55%, #F1E7D3 100%);
}
.login-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(200, 137, 42, .10) 1px, transparent 1px);
  background-size: 26px 26px; opacity: .7;
}
.login-card {
  position: relative; width: 400px; max-width: calc(100vw - 32px);
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px);
  border: 1px solid #fff; border-radius: 22px; padding: 34px 34px 24px;
  box-shadow: 0 30px 70px rgba(35, 43, 54, .14);
}
.brand-row { display: flex; align-items: center; gap: 11px; }
.logo-mark {
  display: flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 14px;
  background: linear-gradient(135deg, #FDF4E1, #F7E4BC);
  box-shadow: inset 0 0 0 1px rgba(200, 137, 42, .18);
}
.logo-mark.sm { width: 34px; height: 34px; border-radius: 10px; }
.brand-title { font-size: 16px; font-weight: 700; letter-spacing: .02em; }
.brand-sub { font-size: 9.5px; color: var(--gold-deep); letter-spacing: .22em; font-weight: 700; }
.brand-text { font-size: 15.5px; font-weight: 700; }
.login-h1 { font-size: 25px; margin: 26px 0 6px; letter-spacing: -.01em; }
.login-p { color: var(--ink-3); margin: 0 0 22px; font-size: 13.5px; }
.login-error {
  background: #FDF1F0; border: 1px solid #F6D5D3; color: #B33B36;
  border-radius: 9px; padding: 9px 12px; font-size: 13px; margin-bottom: 14px;
}
.login-foot { text-align: center; color: var(--ink-3); font-size: 12px; margin-top: 18px; }

/* --------------------------- 顶栏 --------------------------- */
.app { height: 100%; display: flex; flex-direction: column; }
.topbar {
  height: 58px; flex: 0 0 58px; display: flex; align-items: center; gap: 18px;
  padding: 0 16px; background: #fff; border-bottom: 1px solid var(--line);
  position: relative; z-index: 30;
}
.search-wrap {
  flex: 1; max-width: 640px; margin: 0 auto; position: relative; display: flex; align-items: center;
}
.search-wrap .ico { position: absolute; left: 12px; color: var(--ink-3); }
.search-wrap input {
  width: 100%; height: 38px; border-radius: 999px; border: 1px solid var(--line);
  background: #FAF8F4; padding: 0 36px; outline: none; transition: .16s;
}
.search-wrap input:focus { background: #fff; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(227, 176, 75, .14); }
.search-clear {
  position: absolute; right: 10px; border: 0; background: transparent; color: var(--ink-3); font-size: 18px;
}
.top-actions { display: flex; align-items: center; gap: 8px; }
.user-chip {
  position: relative; display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px;
  border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer;
}
.user-chip:hover { border-color: var(--gold-line); background: var(--gold-soft); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--gold-1), var(--gold-2)); color: #fff; font-weight: 700; font-size: 13px;
}
.user-meta { line-height: 1.15; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 10.5px; color: var(--ink-3); }
.user-menu {
  position: absolute; top: 46px; right: 0; min-width: 172px; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  padding: 6px; z-index: 50;
}
.menu-item { padding: 9px 12px; border-radius: 8px; font-size: 13.2px; color: var(--ink-2); }
.menu-item:hover { background: var(--gold-soft); color: var(--gold-deep); }
.menu-item.danger:hover { background: #FDF1F0; color: var(--danger); }
.ctx-menu {
  position: fixed; min-width: 148px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 120;
}
.acct-more {
  border: 0; background: transparent; color: var(--ink-3); font-size: 15px; line-height: 1;
  padding: 2px 5px; border-radius: 6px; opacity: 0; transition: .14s;
}
.account-item:hover .acct-more { opacity: 1; }
.acct-more:hover { background: #fff; color: var(--gold-deep); }

/* --------------------------- 布局 --------------------------- */
.layout { flex: 1; display: grid; grid-template-columns: 250px 384px 1fr; min-height: 0; }

.sidebar {
  background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 8px; font-size: 12px; font-weight: 700; color: var(--ink-3);
  letter-spacing: .06em;
}
.folder-head { padding-top: 16px; }
.account-list, .folder-list { overflow-y: auto; padding: 0 8px; }
.folder-list { flex: 1; }
.account-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 10px;
  cursor: pointer; transition: .14s; margin-bottom: 2px;
}
.account-item:hover { background: #FAF8F3; }
.account-item.active { background: var(--gold-soft); box-shadow: inset 0 0 0 1px var(--gold-line); }
.acct-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); flex: 0 0 auto; }
.acct-info { flex: 1; min-width: 0; }
.acct-name { font-size: 13.2px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-email { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge {
  min-width: 20px; height: 19px; padding: 0 6px; border-radius: 999px; background: var(--gold);
  color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.badge.gray { background: #DCE0E6; color: #6B7684; }
.folder-item {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 9px;
  cursor: pointer; color: var(--ink-2); font-size: 13.2px; transition: .14s;
}
.folder-item:hover { background: #FAF8F3; }
.folder-item.active { background: var(--gold-soft); color: var(--gold-deep); font-weight: 600; }
.folder-item .f-ico { width: 16px; text-align: center; opacity: .8; }
.folder-item .f-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-block { margin-bottom: 6px; }
.acct-block .acct-folders { padding-left: 4px; }
.side-footer { border-top: 1px solid var(--line); padding: 10px 14px; }
.storage-line { font-size: 11.5px; color: var(--ink-3); line-height: 1.6; }

/* --------------------------- 邮件列表 --------------------------- */
.list-pane {
  background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.list-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.list-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.list-title h2 { font-size: 15px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count-pill { font-size: 11.5px; color: var(--ink-3); background: #F4F1EA; border-radius: 999px; padding: 2px 8px; }
.list-tools { display: flex; align-items: center; gap: 6px; }
.check-all { display: flex; align-items: center; }
.batch-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 14px; background: var(--gold-soft); border-bottom: 1px solid var(--gold-line);
  font-size: 12.5px; color: var(--gold-deep);
}
.batch-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.batch-actions button {
  border: 1px solid var(--gold-line); background: #fff; color: var(--gold-deep);
  border-radius: 7px; padding: 4px 8px; font-size: 12px;
}
.batch-actions button:hover { background: #fff; border-color: var(--gold); }
.batch-actions button.danger { color: var(--danger); border-color: #F4DAD8; }
.mail-list { flex: 1; overflow-y: auto; min-height: 0; }
.mail-row {
  display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid #F4F1EB;
  cursor: pointer; transition: .12s; position: relative;
}
.mail-row:hover { background: #FCFAF5; }
.mail-row.active { background: var(--gold-soft); }
.mail-row.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gold);
}
.mail-row input[type=checkbox] { margin-top: 2px; flex: 0 0 auto; }
.mail-main { flex: 1; min-width: 0; }
.mail-top { display: flex; align-items: baseline; gap: 6px; }
.mail-from { font-size: 13.2px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-time { font-size: 11px; color: var(--ink-3); flex: 0 0 auto; }
.mail-subject { font-size: 13.2px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-snippet { font-size: 12px; color: var(--ink-3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-tags { display: flex; gap: 5px; margin-top: 6px; align-items: center; }
.tag {
  font-size: 10.5px; padding: 1px 7px; border-radius: 999px;
  background: #F2F3F5; color: var(--ink-2);
}
.tag.gold { background: var(--gold-soft); color: var(--gold-deep); }
.tag.dark { background: #EEF1F5; color: #55606E; }
.star-btn { border: 0; background: transparent; font-size: 15px; color: #D8DCE2; line-height: 1; padding: 0 2px; }
.star-btn.on { color: var(--gold); }
.mail-row.unread .mail-from, .mail-row.unread .mail-subject { font-weight: 700; color: #161B22; }
.mail-row.unread .mail-time::before {
  content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold); margin-right: 5px;
}
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.pager button {
  min-width: 30px; height: 28px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 12.5px;
}
.pager button.cur { background: var(--gold); border-color: var(--gold); color: #fff; font-weight: 700; }
.pager button:disabled { opacity: .45; }
.list-empty { padding: 60px 20px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* --------------------------- 阅读区 --------------------------- */
.reading-pane { background: #FBFAF7; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--ink-3); gap: 12px; }
.empty-state p { margin: 0; font-size: 15px; color: var(--ink-2); }
.empty-state span { font-size: 12.5px; }
.empty-ico { opacity: .75; }
.reading-inner { flex: 1; display: flex; flex-direction: column; min-height: 0; background: #fff; }
.read-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--line); }
.read-subject { font-size: 19px; font-weight: 700; margin: 0 0 12px; line-height: 1.4; word-break: break-word; }
.read-meta { display: flex; align-items: center; gap: 12px; }
.read-avatar {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--gold-1), var(--gold-2)); color: #fff; font-weight: 700; font-size: 15px;
}
.read-who { flex: 1; min-width: 0; }
.read-from { font-size: 13.8px; font-weight: 600; }
.read-to { font-size: 12px; color: var(--ink-3); margin-top: 2px; word-break: break-all; }
.read-date { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.read-tools { display: flex; gap: 6px; padding: 10px 22px; border-bottom: 1px solid var(--line); background: #FDFCF9; flex-wrap: wrap; }
.read-body { flex: 1; overflow: auto; padding: 0; min-height: 0; }
.read-body iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.read-body pre { margin: 0; padding: 20px 22px; white-space: pre-wrap; word-break: break-word;
  font-family: inherit; font-size: 13.6px; line-height: 1.75; color: #2C3542; }
.attach-box { padding: 12px 22px 18px; border-top: 1px solid var(--line); background: #FDFCF9; }
.attach-box h4 { margin: 0 0 8px; font-size: 12px; color: var(--ink-3); font-weight: 700; letter-spacing: .05em; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; margin: 0 8px 8px 0;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 12.6px; color: var(--ink-2);
}
.attach-chip:hover { border-color: var(--gold); background: var(--gold-soft); color: var(--gold-deep); text-decoration: none; }
.attach-chip .sz { color: var(--ink-3); font-size: 11px; }
.loading-line { padding: 40px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* --------------------------- 弹窗 --------------------------- */
.modal {
  position: fixed; inset: 0; background: rgba(30, 36, 44, .42); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px;
}
.modal-card {
  width: 560px; max-width: 100%; max-height: 92vh; background: #fff; border-radius: 18px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden;
  animation: pop .18s ease;
}
.modal-card.wide { width: 760px; }
.modal-card.narrow { width: 420px; }
@keyframes pop { from { transform: translateY(10px) scale(.985); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close { border: 0; background: transparent; font-size: 22px; line-height: 1; color: var(--ink-3); }
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; gap: 8px; padding: 14px 20px;
  border-top: 1px solid var(--line); background: #FDFCF9;
}
.test-result {
  border-radius: 10px; padding: 10px 12px; font-size: 12.6px; line-height: 1.7;
  background: #F6F8FA; border: 1px solid var(--line); color: var(--ink-2); white-space: pre-wrap;
}
.test-result.ok { background: #F0F9F3; border-color: #CFE9DA; color: #2E7D4F; }
.test-result.err { background: #FDF1F0; border-color: #F6D5D3; color: #B33B36; }

.attach-row { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.file-btn { position: relative; overflow: hidden; }
.attach-list { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.attach-item {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px 5px 10px;
  background: var(--gold-soft); border: 1px solid var(--gold-line); border-radius: 8px; font-size: 12.3px;
}
.attach-item button { border: 0; background: transparent; color: var(--ink-3); font-size: 14px; }
.attach-item button:hover { color: var(--danger); }

/* --------------------------- 管理端 --------------------------- */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tab {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 9px; padding: 7px 14px; font-size: 13px;
}
.tab.active { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold-deep); font-weight: 600; }
.new-user { display: grid; grid-template-columns: 1fr 1fr 1fr 110px auto; gap: 8px; margin-bottom: 14px; }
.new-user input, .new-user select {
  height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; outline: none;
}
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; padding: 9px 10px; background: #FAF8F3; color: var(--ink-3);
  font-size: 12px; font-weight: 600; border-bottom: 1px solid var(--line);
}
table.data td { padding: 10px; border-bottom: 1px solid #F3F0E9; vertical-align: middle; }
table.data tr:hover td { background: #FCFAF6; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions button {
  border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 4px 9px;
  font-size: 12px; color: var(--ink-2);
}
.row-actions button:hover { border-color: var(--gold); color: var(--gold-deep); background: var(--gold-soft); }
.row-actions button.danger { color: var(--danger); border-color: #F4DAD8; }
.row-actions button.danger:hover { background: #FDF1F0; }
.status-pill { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; }
.status-pill.on { background: #EAF7EF; color: #2E7D4F; }
.status-pill.off { background: #F2F3F5; color: #6B7684; }
.overview-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.ov-card {
  border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  background: linear-gradient(160deg, #FFFDF7, #FDF8EC);
}
.ov-num { font-size: 23px; font-weight: 700; color: var(--gold-deep); }
.ov-label { font-size: 12px; color: var(--ink-3); margin-top: 3px; }

/* --------------------------- Toast --------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%);
  background: #2A3340; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13.2px; box-shadow: var(--shadow); z-index: 200; max-width: 80vw;
}
.toast.err { background: #B33B36; }

/* --------------------------- 滚动条 --------------------------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #DED8CB; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-1); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* --------------------------- 智能分类 / 移动端组件 --------------------------- */
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold-deep); }
.mobile-only { display: none; }
.smart-list { padding: 0 8px 4px; }
.smart-item {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 9px;
  cursor: pointer; color: var(--ink-2); font-size: 13.2px; transition: .14s;
}
.smart-item:hover { background: #FAF8F3; }
.smart-item.active { background: var(--gold-soft); color: var(--gold-deep); font-weight: 600; }
.smart-item .s-ico { width: 16px; display: flex; justify-content: center; opacity: .85; }
.smart-item .s-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag.danger { background: #FDF0EF; color: #C0453F; }
.tag.info { background: #EEF3FA; color: #4A6C97; }
.read-back { display: none; }
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(30, 36, 44, .42);
  z-index: 88; display: none; -webkit-backdrop-filter: blur(1px); backdrop-filter: blur(1px);
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.score-line { font-size: 11.5px; color: var(--ink-3); }

/* --------------------------- 自适应 --------------------------- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 220px 330px 1fr; }
  .search-wrap { max-width: 340px; }
}

/* ---------- 平板 / 手机 ---------- */
@media (max-width: 900px) {
  body { -webkit-text-size-adjust: 100%; }
  .mobile-only { display: inline-flex; }
  .app { height: 100dvh; }
  .topbar {
    height: auto; flex: 0 0 auto; flex-wrap: wrap; align-items: center;
    padding: 8px 10px; gap: 8px;
    padding-top: max(8px, env(safe-area-inset-top));
  }
  .brand-row.small .brand-text { display: none; }
  .search-wrap { order: 10; flex: 1 0 100%; max-width: none; margin: 0; }
  .search-wrap input { height: 38px; }
  .top-actions { margin-left: auto; gap: 6px; }
  .top-actions .btn { height: 38px; padding: 0 11px; }
  .top-actions .btn > span { display: none; }
  .user-meta, .user-chip > svg { display: none; }
  .user-chip { padding: 3px; border: 0; }
  .avatar { width: 34px; height: 34px; font-size: 14px; }

  .layout { grid-template-columns: 1fr; }

  /* 侧栏抽屉 */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 302px; max-width: 86vw; z-index: 90;
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg);
    padding-top: env(safe-area-inset-top);
  }
  body.drawer-open .sidebar { transform: none; }
  body.drawer-open .drawer-backdrop { display: block; }
  .account-item, .folder-item, .smart-item { padding: 10px 12px; }

  /* 阅读区全屏 */
  .reading-pane { position: fixed; inset: 0; z-index: 70; display: none; }
  body.reading-open .reading-pane { display: flex; }
  .read-back { display: inline-flex; }
  .list-pane { border-right: 0; }
  .reading-pane .empty-state { display: none; }

  .mail-row { padding: 12px; gap: 8px; }
  .mail-row input[type=checkbox] { width: 18px; height: 18px; }
  .star-btn { font-size: 18px; padding: 0 4px; }
  .list-head { padding: 10px 12px; }
  .batch-bar { padding: 8px 12px; }
  .batch-actions button { padding: 6px 9px; }

  .read-head { padding: 14px 14px 10px; }
  .read-subject { font-size: 17px; }
  .read-tools { padding: 8px 12px; gap: 6px; overflow-x: auto; flex-wrap: nowrap; }
  .read-tools .btn { flex: 0 0 auto; }
  .read-tools .read-back {
    position: sticky; left: -12px; margin-left: -12px; padding-left: 14px;
    background: linear-gradient(90deg, #FDFCF9 82%, rgba(253, 252, 249, 0)); z-index: 2;
  }
  .read-body pre { padding: 14px; }
  .attach-box { padding: 10px 14px 16px; }

  /* 弹窗全屏 / 底部弹层 */
  .modal { padding: 0; align-items: flex-end; }
  .modal-card { width: 100%; max-height: 94vh; border-radius: 18px 18px 0 0; }
  .modal-card.wide { width: 100%; height: 100vh; max-height: 100vh; border-radius: 0; }
  .modal-foot { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .modal-body { padding: 16px 14px; }
  .field input, .field select, .field textarea,
  .new-user input, .new-user select, .search-wrap input { font-size: 16px; }
  .field textarea { min-height: 170px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; gap: 0; }
  .field.checkline { padding-top: 0; margin-top: -4px; }
  .field.checkline.top-gap { margin-top: 4px; }
  .new-user { grid-template-columns: 1fr 1fr; }
  .new-user button { grid-column: 1 / -1; }
  .overview-grid { grid-template-columns: 1fr 1fr; }
  .tabs { flex-wrap: wrap; }
  .toast { bottom: calc(24px + env(safe-area-inset-bottom)); width: calc(100% - 32px); text-align: center; }
}

@media (max-width: 420px) {
  .brand-text { display: none; }
  .mail-tags .tag { font-size: 10px; }
  .overview-grid { grid-template-columns: 1fr; }
}
