/* ========== 设计令牌 ========== */
:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef0f3;
  --hover: #f0f2f5;
  --border: #e3e6ea;
  --border-strong: #d3d8de;
  --text: #1c2025;
  --text-2: #4b5560;
  --text-3: #7b8591;
  --accent: #2f6bff;
  --accent-hover: #1f58e6;
  --accent-soft: #e9f0ff;
  --accent-text: #1a4fd6;
  --selected: #e6eeff;
  --rail: #14171c;
  --rail-text: #9aa3ad;
  --rail-active: #ffffff;

  --ok: #1a9a55;
  --ok-soft: #e4f6ec;
  --warn: #b86e00;
  --warn-soft: #fff3dc;
  --danger: #d4342a;
  --danger-soft: #fdeceb;
  --muted-soft: #eef0f3;
  --info: #6247d6;
  --info-soft: #efebff;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 6px 20px rgba(16, 24, 40, .10);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .18);
  --radius: 10px;
  --radius-sm: 7px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0e1013;
  --surface: #16191e;
  --surface-2: #1b1f25;
  --surface-3: #232830;
  --hover: #1f242b;
  --border: #2a3038;
  --border-strong: #363d47;
  --text: #e7eaee;
  --text-2: #b3bcc6;
  --text-3: #7f8a96;
  --accent: #5b8cff;
  --accent-hover: #75a0ff;
  --accent-soft: #1d2a47;
  --accent-text: #8fb0ff;
  --selected: #1f2c49;
  --rail: #0a0b0d;
  --ok: #3cc47c;
  --ok-soft: #14301f;
  --warn: #e7a43c;
  --warn-soft: #36270f;
  --danger: #ff6b61;
  --danger-soft: #3a1a18;
  --muted-soft: #252a31;
  --info: #a491ff;
  --info-soft: #261f45;
  --shadow-md: 0 6px 20px rgba(0, 0, 0, .4);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; }
body {
  margin: 0;
  font: 14px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.muted { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ========== 按钮与表单 ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  cursor: pointer; white-space: nowrap; font-weight: 500; transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn .i { width: 16px; height: 16px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--text-2); cursor: pointer;
  position: relative;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn.active { color: var(--accent); }
.icon-btn .i { width: 18px; height: 18px; }

[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: #111; color: #fff; font-size: 12px; padding: 3px 8px; border-radius: 5px; white-space: nowrap;
  pointer-events: none; z-index: 50; font-weight: 400;
}

.input, .select, .textarea {
  height: 34px; padding: 0 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); outline: none; min-width: 0;
  transition: border-color .12s, box-shadow .12s;
}
.textarea { height: auto; padding: 10px 11px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select { padding-right: 28px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237b8591' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; }
.search { min-width: 0;
  display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px;
  border-radius: var(--radius-sm); background: var(--surface-3); border: 1px solid transparent; color: var(--text-3);
}
.search:focus-within { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; color: var(--text); }
.search .i { width: 16px; height: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.checkbox { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; margin: 0; }
kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); color: var(--text-2); }

/* 徽章 */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 99px;
  font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--muted-soft); color: var(--text-2);
}
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.badge.outline { background: transparent; border: 1px solid var(--border-strong); }
.chip { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }

.avatar {
  flex: none; display: grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 600;
  width: 36px; height: 36px; font-size: 14px; letter-spacing: .5px; user-select: none;
}
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.avatar.lg { width: 42px; height: 42px; font-size: 16px; }

.spinner { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--hover) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 6px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ========== 登录 ========== */
.login {
  height: 100%; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent 60%), var(--bg);
}
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; box-shadow: var(--shadow-md); }
.login-card h1 { font-size: 20px; margin: 16px 0 4px; }
.login-card p { margin: 0 0 22px; color: var(--text-3); font-size: 13.5px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-card .btn { height: 40px; }
.login-err { color: var(--danger); font-size: 13px; min-height: 18px; }
.logo { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #3d7bff, #6a4cff); box-shadow: 0 6px 16px rgba(61, 123, 255, .35); }
.logo .i { width: 22px; height: 22px; stroke-width: 2; }

/* 登录流程 */
.login-foot { margin-top: 18px; text-align: center; font-size: 13px; }
.login-link { color: var(--text-3); }
.login-link:hover { color: var(--accent-text); }
.otp-input { height: 52px !important; text-align: center; font: 600 26px/1 var(--mono); letter-spacing: 10px; padding-left: 20px; }
.enroll { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.enroll-steps { margin: 0; padding-left: 20px; font-size: 13px; color: var(--text-2); display: flex; flex-direction: column; gap: 4px; }
.qr { width: 184px; height: 184px; margin: 0 auto; padding: 8px; background: #fff; border-radius: 12px; border: 1px solid var(--border); }
.qr svg { width: 100%; height: 100%; display: block; }
.enroll-manual summary { cursor: pointer; font-size: 13px; color: var(--accent-text); }
.secret { font: 600 13px var(--mono); letter-spacing: 1px; background: var(--surface-3); padding: 6px 8px; border-radius: 6px; word-break: break-all; flex: 1; }

/* 设置 */
.settings { display: flex; flex-direction: column; gap: 16px; }
.settings-section { padding: 18px 20px; }
.settings-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.settings-head h3 { margin: 0; font-size: 15px; }
.settings-head p { margin: 4px 0 0; font-size: 13px; color: var(--text-3); }
.acct-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.acct-card .badge .i { width: 13px; height: 13px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.list-row:first-child { border-top: 0; }
.list-row .ic { width: 36px; height: 36px; border-radius: 9px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-2); flex: none; }
.list-row .row { gap: 8px; flex-wrap: wrap; }

/* ========== 外壳 ========== */
.shell { display: flex; height: 100%; }
.rail { width: 64px; flex: none; background: var(--rail); display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 6px; }
.rail .logo { width: 36px; height: 36px; margin-bottom: 14px; box-shadow: none; }
.rail-btn {
  width: 46px; height: 46px; border-radius: 12px; border: 0; background: transparent; color: var(--rail-text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; font-size: 10.5px;
}
.rail-btn:hover { background: rgba(255, 255, 255, .07); color: #dfe3e8; }
.rail-btn.active { background: rgba(255, 255, 255, .12); color: var(--rail-active); }
.rail-btn .i { width: 20px; height: 20px; }
.rail .spacer { flex: 1; }
.view { flex: 1; min-width: 0; display: flex; }

/* ========== 邮件视图 ========== */
.mail { display: flex; flex: 1; min-width: 0; }
.sidebar { width: 252px; flex: none; background: var(--surface-2); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.sidebar-top { padding: 14px 12px 8px; display: flex; flex-direction: column; gap: 10px; }
.compose-btn { height: 42px; border-radius: 12px; font-size: 14.5px; gap: 8px; box-shadow: 0 2px 8px rgba(47, 107, 255, .25); }

.acct-switch {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-align: left;
}
.acct-switch:hover { border-color: var(--border-strong); }
.acct-switch .meta { flex: 1; min-width: 0; }
.acct-switch .email { font-weight: 600; font-size: 13px; }
.acct-switch .sub { font-size: 11.5px; color: var(--text-3); display: flex; gap: 6px; align-items: center; }
.acct-switch > .i { color: var(--text-3); width: 16px; height: 16px; }

.folders { flex: 1; overflow: auto; padding: 4px 8px 16px; }
.folder-group { font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; padding: 14px 10px 6px; }
.folder {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-2); user-select: none; border: 0; width: 100%; background: transparent; text-align: left;
}
.folder:hover { background: var(--hover); color: var(--text); }
.folder.active { background: var(--selected); color: var(--accent-text); font-weight: 600; }
.folder .name { flex: 1; min-width: 0; }
.folder .count { font-size: 12px; font-weight: 600; color: var(--text-2); }
.folder.active .count { color: var(--accent-text); }
.folder .i { width: 17px; height: 17px; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 10px 14px; font-size: 12px; color: var(--text-3); }

.list-pane { width: 380px; flex: none; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--surface); min-height: 0; }
.list-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.list-title { display: flex; align-items: center; gap: 8px; }
.list-title h2 { font-size: 17px; margin: 0; flex: 1; min-width: 0; }
.seg { flex: none; white-space: nowrap; display: inline-flex; background: var(--surface-3); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: transparent; height: 26px; padding: 0 10px; border-radius: 6px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }
.msg-list { flex: 1; overflow: auto; }
.msg-item {
  position: relative; display: flex; gap: 11px; padding: 12px 14px 12px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; outline: none;
}
.msg-item:hover { background: var(--hover); }
.msg-item.selected { background: var(--selected); }
.msg-item.unread::before { content: ""; position: absolute; left: 5px; top: 22px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.msg-item .body { flex: 1; min-width: 0; }
.msg-item .top { display: flex; align-items: baseline; gap: 8px; }
.msg-item .from { flex: 1; min-width: 0; font-size: 14px; color: var(--text-2); }
.msg-item.unread .from { color: var(--text); font-weight: 650; }
.msg-item .time { font-size: 12px; color: var(--text-3); flex: none; }
.msg-item.unread .time { color: var(--accent-text); font-weight: 600; }
.msg-item .subject { font-size: 13.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; margin-top: 1px; }
.msg-item.unread .subject { color: var(--text); font-weight: 600; }
.msg-item .subject .t { flex: 1; min-width: 0; }
.msg-item .subject .i { width: 14px; height: 14px; color: var(--text-3); }
.msg-item .subject .flag { color: var(--danger); }
.msg-item .preview { font-size: 12.5px; color: var(--text-3); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.msg-item .acct { margin-top: 6px; }
.msg-item .hover-actions { position: absolute; right: 10px; top: 34px; display: none; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 2px; box-shadow: var(--shadow-sm); }
.msg-item:hover .hover-actions { display: flex; }
.msg-item .hover-actions .icon-btn { width: 28px; height: 28px; }
.msg-item .hover-actions .icon-btn .i { width: 16px; height: 16px; }
.list-foot { padding: 14px; text-align: center; color: var(--text-3); font-size: 12.5px; display: flex; justify-content: center; }
.sk-item { display: flex; gap: 11px; padding: 14px 16px; border-bottom: 1px solid var(--border); }

.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; color: var(--text-3); padding: 40px 24px; height: 100%; }
.empty .big { width: 64px; height: 64px; border-radius: 20px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-3); margin-bottom: 6px; }
.empty .big .i { width: 30px; height: 30px; stroke-width: 1.5; }
.empty h3 { margin: 0; color: var(--text-2); font-size: 15px; }
.empty p { margin: 0; font-size: 13px; max-width: 320px; }

.reader { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface); min-height: 0; }
.reader-bar { display: flex; align-items: center; gap: 2px; padding: 8px 14px; border-bottom: 1px solid var(--border); min-height: 52px; }
.reader-bar .sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; }
.reader-scroll { flex: 1; overflow: auto; }
.reader-inner { max-width: 960px; margin: 0 auto; padding: 22px 28px 40px; }
.reader h1 { font-size: 21px; line-height: 1.35; margin: 0 0 18px; font-weight: 650; word-break: break-word; display: flex; gap: 10px; align-items: flex-start; }
.reader h1 .flag { color: var(--danger); margin-top: 5px; }
.sender { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.sender .who { flex: 1; min-width: 0; }
.sender .name { font-weight: 600; }
.sender .addr { color: var(--text-3); font-size: 13px; }
.sender .rcpt { color: var(--text-3); font-size: 12.5px; margin-top: 2px; word-break: break-all; }
.sender .when { color: var(--text-3); font-size: 12.5px; white-space: nowrap; text-align: right; }
.notice { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); margin-bottom: 14px; }
.notice .i { width: 16px; height: 16px; color: var(--text-3); }
.notice.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.mail-frame { width: 100%; border: 0; display: block; min-height: 120px; background: #fff; border-radius: 6px; }
.text-body { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; line-height: 1.7; margin: 0; font-family: var(--font); }
.attachments { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.att { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; max-width: 280px; background: var(--surface); }
.att:hover { border-color: var(--accent); background: var(--accent-soft); }
.att .ic { width: 34px; height: 34px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-2); flex: none; }
.att .nm { font-size: 13px; font-weight: 500; }
.att .sz { font-size: 11.5px; color: var(--text-3); }
.quick-reply { margin-top: 26px; display: flex; gap: 8px; }

/* 下拉菜单 / 浮层 */
.popover {
  position: fixed; z-index: 100; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 6px; min-width: 200px; max-height: 70vh; overflow: auto; animation: pop .12s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; text-align: left; font-size: 13.5px; color: var(--text); }
.menu-item:hover, .menu-item.kb { background: var(--hover); }
.menu-item.danger { color: var(--danger); }
.menu-item .i { width: 16px; height: 16px; color: var(--text-3); }
.menu-item.danger .i { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.menu-label { font-size: 11.5px; color: var(--text-3); padding: 6px 10px 4px; font-weight: 600; }

.acct-pop { width: 360px; padding: 0; display: flex; flex-direction: column; max-height: 520px; }
.acct-pop .search { margin: 10px; }
.acct-pop .results { overflow: auto; padding: 0 6px 6px; }
.acct-opt { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; cursor: pointer; }
.acct-opt:hover, .acct-opt.kb { background: var(--hover); }
.acct-opt.current { background: var(--selected); }
.acct-opt .meta { flex: 1; min-width: 0; }
.acct-opt .email { font-size: 13.5px; font-weight: 500; }
.acct-opt .sub { font-size: 11.5px; color: var(--text-3); }
.acct-pop .foot { border-top: 1px solid var(--border); padding: 8px 12px; font-size: 12px; color: var(--text-3); display: flex; justify-content: space-between; }

/* ========== 写信窗口 ========== */
.compose {
  position: fixed; right: 24px; bottom: 0; width: 600px; max-width: calc(100vw - 32px); height: min(620px, calc(100vh - 60px));
  background: var(--surface); border: 1px solid var(--border); border-bottom: 0; border-radius: 12px 12px 0 0;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; z-index: 80; animation: up .16s ease-out;
}
@keyframes up { from { transform: translateY(20px); opacity: 0; } }
.compose.min { height: 46px; overflow: hidden; }
.compose.max { right: 50%; transform: translateX(50%); bottom: 4vh; width: min(1000px, 92vw); height: 88vh; border-radius: 12px; border-bottom: 1px solid var(--border); animation: none; }
.compose-head { display: flex; align-items: center; gap: 4px; height: 46px; padding: 0 8px 0 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); border-radius: 12px 12px 0 0; cursor: pointer; flex: none; }
.compose-head .t { flex: 1; font-weight: 600; font-size: 14px; }
.compose-row { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); padding: 0 16px; min-height: 42px; flex: none; }
.compose-row > label { color: var(--text-3); font-size: 13px; width: 52px; flex: none; }
.compose-row input { flex: 1; border: 0; outline: 0; background: transparent; height: 40px; min-width: 0; }
.compose-row .toggles { display: flex; gap: 4px; }
.compose-row .toggles button { border: 0; background: transparent; color: var(--text-3); cursor: pointer; font-size: 13px; padding: 4px 6px; border-radius: 5px; }
.compose-row .toggles button:hover { background: var(--hover); color: var(--text); }
.compose-row .from { flex: 1; font-size: 13.5px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.compose textarea { flex: 1; border: 0; outline: 0; resize: none; padding: 14px 16px; background: transparent; font-size: 14.5px; line-height: 1.65; min-height: 0; }
.compose .quote { margin: 0 16px 10px; padding: 10px 12px; border-left: 3px solid var(--border-strong); color: var(--text-3); font-size: 12.5px; max-height: 120px; overflow: auto; flex: none; background: var(--surface-2); border-radius: 0 6px 6px 0; }
.compose-foot { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--border); flex: none; }
.compose-foot .hint { flex: 1; font-size: 12px; color: var(--text-3); }

/* ========== 账号管理 ========== */
.page { flex: 1; min-width: 0; overflow: auto; background: var(--bg); }
.page-inner { padding: 24px 28px 40px; max-width: 1600px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; flex: 1; }
.page-head .desc { color: var(--text-3); font-size: 13px; font-weight: 400; margin-left: 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; transition: border-color .12s, box-shadow .12s; text-align: left; }
.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.stat.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.stat .k { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.stat .k::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--text-3)); }
.stat .v { font-size: 24px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar .search { width: 280px; }
.bulkbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--accent-soft); color: var(--accent-text); border-bottom: 1px solid var(--border); flex-wrap: wrap; font-size: 13.5px; }
.bulkbar .btn { background: var(--surface); }
.bulkbar a { cursor: pointer; font-weight: 600; }
.table-wrap { overflow: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th { text-align: left; font-weight: 600; font-size: 12px; color: var(--text-3); padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
table.grid tbody tr { cursor: pointer; }
table.grid tbody tr:hover td { background: var(--hover); }
table.grid tbody tr.sel td { background: var(--selected); }
table.grid .w-check { width: 40px; }
.cell-email { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.cell-email .e { font-weight: 500; }
.cell-email .s { font-size: 12px; color: var(--text-3); display: flex; gap: 6px; align-items: center; margin-top: 1px; }
.err-text { color: var(--danger); font-size: 12.5px; max-width: 240px; }
.age-ok { color: var(--text-2); }
.age-warn { color: var(--warn); }
.age-bad { color: var(--danger); font-weight: 600; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.pager { display: flex; align-items: center; gap: 8px; padding: 10px 14px; justify-content: flex-end; color: var(--text-3); font-size: 13px; }

/* 分组 */
.gdot { display: inline-block; border-radius: 50%; flex: none; }
.gchip { gap: 5px; }
.acc-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
.group-panel { position: sticky; top: 0; padding: 8px; }
.group-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 6px 8px; font-size: 12px; font-weight: 650; color: var(--text-3); letter-spacing: .3px; }
.group-list { display: flex; flex-direction: column; gap: 1px; max-height: calc(100vh - 220px); overflow: auto; }
.group-item { display: flex; align-items: center; gap: 9px; height: 34px; padding: 0 6px 0 10px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-2); position: relative; }
.group-item:hover { background: var(--hover); color: var(--text); }
.group-item.active { background: var(--selected); color: var(--accent-text); font-weight: 600; }
.group-item .i { width: 16px; height: 16px; }
.group-item .name { flex: 1; min-width: 0; }
.group-item .count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; min-width: 18px; text-align: right; }
.group-item .gmore { width: 24px; height: 24px; display: none; margin-left: -2px; }
.group-item .gmore .i { width: 15px; height: 15px; }
.group-item:hover .gmore { display: inline-grid; }
.group-item:hover .count { display: none; }
.group-item.drop { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft); }
.dragging-accounts .group-item:not(:first-child) { outline: 1px dashed var(--border-strong); outline-offset: -1px; }
.gproblem { font-size: 11px; font-weight: 600; color: var(--warn); background: var(--warn-soft); border-radius: 99px; padding: 0 6px; line-height: 18px; }
.group-sep { height: 1px; background: var(--border); margin: 6px 6px; }
.group-new { margin: 6px 4px; justify-content: flex-start; }
.group-hint { font-size: 11.5px; color: var(--text-3); padding: 10px 8px 4px; border-top: 1px solid var(--border); margin-top: 8px; }
.table-title { font-size: 14px; padding: 0 4px; max-width: 200px; }
.table-title .row { gap: 7px; }
.drag-ghost { position: fixed; top: -100px; left: -100px; display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--accent); color: #fff; border-radius: 8px; font-size: 13px; font-weight: 600; }
.drag-ghost .i { width: 15px; height: 15px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 2px var(--surface); }
.swatch.on { border-color: var(--text); }
.folder .gdot { margin: 0 4px; }
.folder .caret { width: 20px; height: 20px; display: inline-grid; place-items: center; margin-left: -6px; margin-right: -4px; border-radius: 4px; color: var(--text-3); flex: none; }
.folder .caret:hover { background: var(--surface-3); }
.folder .caret .i { width: 14px; height: 14px; transition: transform .12s; }
.folder .caret.open .i { transform: rotate(90deg); }
.folder.sub { height: 30px; padding-left: 34px; font-size: 13px; }
.folder.sub .avatar { width: 18px; height: 18px; font-size: 9px; }
.folder.more { height: 28px; padding-left: 34px; font-size: 12.5px; color: var(--accent-text); }

/* 抽屉 */
.drawer-mask { position: fixed; inset: 0; background: rgba(10, 14, 20, .35); z-index: 90; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 520px; max-width: 100vw; background: var(--surface); z-index: 91; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-head .t { flex: 1; min-width: 0; }
.drawer-head .t .e { font-weight: 650; font-size: 16px; }
.drawer-body { flex: 1; overflow: auto; padding: 18px 20px 30px; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 10px 14px; font-size: 13.5px; margin-bottom: 22px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; word-break: break-all; }
.section-title { font-size: 13px; font-weight: 650; color: var(--text-2); margin: 0 0 10px; }
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.tl-item .when { color: var(--text-3); width: 92px; flex: none; font-size: 12px; padding-top: 2px; }
.tl-item .what { flex: 1; min-width: 0; word-break: break-word; }
.tl-item .what .d { color: var(--text-2); margin-top: 3px; font-size: 12.5px; }

/* 对话框 */
.modal-mask { position: fixed; inset: 0; background: rgba(10, 14, 20, .45); z-index: 95; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: pop .15s ease-out; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 0; }
.modal-head h3 { flex: 1; margin: 0; font-size: 17px; }
.modal-body { padding: 16px 20px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; }
.help { font-size: 12.5px; color: var(--text-3); line-height: 1.6; }
.help code { font-family: var(--mono); background: var(--surface-3); padding: 1px 5px; border-radius: 4px; color: var(--text-2); font-size: 12px; }
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 14px; text-align: center; color: var(--text-3); font-size: 13px; cursor: pointer; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tabs button { border: 0; background: transparent; padding: 9px 12px; cursor: pointer; color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; display: flex; gap: 6px; align-items: center; }
.tabs button.on { color: var(--accent-text); border-bottom-color: var(--accent); }
.tabs .i { width: 16px; height: 16px; }
.device-code { font: 600 30px/1 var(--mono); letter-spacing: 4px; text-align: center; padding: 18px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); user-select: all; }
.status-line { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.result-box { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px; }
.result-box.ok { background: var(--ok-soft); color: var(--ok); }
.result-box.err { background: var(--danger-soft); color: var(--danger); }
.result-box ul { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; }

/* 提示 */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center; pointer-events: none; }
.toast { background: #1d2127; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13.5px; box-shadow: var(--shadow-md); display: flex; gap: 10px; align-items: center; animation: up .18s ease-out; pointer-events: auto; max-width: 560px; }
.toast .i { width: 16px; height: 16px; }
.toast.ok .i { color: #4ade80; }
.toast.err .i { color: #ff7b72; }
.toast button { background: transparent; border: 0; color: #8fb0ff; cursor: pointer; font-weight: 600; padding: 0 0 0 6px; }

/* 日志 */
.log-type { font-family: var(--mono); font-size: 12px; }

/* 快捷键帮助 */
.shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; font-size: 13.5px; }
.shortcuts div { display: flex; justify-content: space-between; gap: 10px; align-items: center; }

/* ========== 响应式 ========== */
.back-btn { display: none; }
.menu-btn { display: none; }
@media (max-width: 1200px) {
  .list-pane { width: 330px; }
  .sidebar { width: 228px; }
}
@media (max-width: 1100px) {
  .acc-layout { grid-template-columns: 1fr; }
  .group-panel { position: static; }
  .group-list { flex-direction: row; flex-wrap: wrap; max-height: none; gap: 4px; }
  .group-item { height: 30px; border: 1px solid var(--border); }
  .group-sep, .group-hint { display: none; }
}
@media (max-width: 960px) {
  .sidebar { position: fixed; left: 64px; top: 0; bottom: 0; z-index: 70; box-shadow: var(--shadow-lg); display: none; }
  .mail.side-open .sidebar { display: flex; animation: slide .18s ease-out; }
  .menu-btn { display: inline-grid; }
  .list-pane { flex: 1; width: auto; min-width: 0; }
  .reader { display: none; }
  .mail.reading .list-pane { display: none; }
  .mail.reading .reader { display: flex; }
  .back-btn { display: inline-grid; }
}
@media (max-width: 640px) {
  .rail { width: 52px; }
  .rail-btn { width: 40px; height: 40px; font-size: 0; }
  .sidebar { left: 52px; }
  .page-inner { padding: 16px; }
  .reader-inner { padding: 16px; }
  .toolbar .search { width: 100%; }
  .compose { right: 0; max-width: 100vw; width: 100vw; }
}
