/* ============================================================
   MailHub — 仿 小苹果Pro 邮箱助手 版式
   顶栏 / 工具栏 / 三栏主体（分组树 + 账号表 + 邮件表）/ 底部状态栏
   ============================================================ */

:root {
  --bg: #f6f8fc;
  --panel: #ffffff;
  --line: #e8eaed;
  --line-2: #dadce0;
  --text: #202124;
  --text-2: #5f6368;
  --muted: #9aa0a6;
  --blue: #5b7cfa;
  --blue-ink: #1a73e8;
  --blue-soft: #d3e3fd;
  --hover: #f1f3f4;
  --green: #34a853;
  --green-soft: #e6f4ea;
  --green-ink: #137333;
  --red: #ea4335;
  --red-soft: #fce8e6;
  --red-ink: #c5221f;
  --amber: #f9ab00;
  --search-bg: #eaf1fb;
  --status-bg: #eef1f7;
  --mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --shadow-pop: 0 8px 24px rgba(32, 33, 36, .18);
}

* { box-sizing: border-box; }

/* hidden 属性优先于任何 display 设定（否则 .tb-btn{display:inline-flex} 会盖掉它） */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; cursor: pointer; }
input, textarea { font: inherit; }
::selection { background: #d2e3fc; }
.muted { color: var(--muted); font-size: 11px; }

/* Material Symbols 尺寸微调 */
.msr { font-size: 18px; }

/* ============================ 顶栏 ============================ */
#app {
  display: grid;
  grid-template-rows: 48px 40px minmax(0, 1fr) 26px;
  height: 100vh;
}

#topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.logo { display: flex; align-items: center; gap: 9px; flex: none; }
.logo-icon {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #6d8bff, #1a73e8);
  color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 1px 3px rgba(26, 115, 232, .35);
}
.logo-text-col { line-height: 1.25; }
.logo-title { font-size: 14px; font-weight: 600; color: var(--text); }
.logo-pro {
  font-size: 8.5px; font-weight: 700; letter-spacing: .5px;
  color: var(--blue-ink); background: var(--search-bg);
  border-radius: 3px; padding: 1px 4px; margin-left: 5px;
  vertical-align: 1px;
}
.logo-sub { font-size: 10px; color: var(--muted); margin-top: 1px; }

.search-box {
  flex: 1;
  max-width: 640px;
  height: 34px;
  display: flex; align-items: center; gap: 9px;
  padding: 0 12px;
  background: var(--search-bg);
  border-radius: 8px;
  transition: background .15s, box-shadow .15s;
}
.search-box:focus-within { background: #fff; box-shadow: 0 1px 4px rgba(32,33,36,.12), 0 0 0 1px var(--line-2); }
.search-box .msr { font-size: 18px; color: #5f6368; }
#global-search {
  flex: 1; min-width: 0; height: 100%;
  border: none; outline: none; background: transparent;
  font-size: 13px; color: var(--text);
}
#global-search::placeholder { color: #7b8794; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  border: none; background: transparent; color: #5f6368;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.on { background: var(--blue-soft); color: var(--blue-ink); }
.top-avatar-wrap {
  display: flex; align-items: center; gap: 4px;
  margin-left: 4px; padding: 3px 6px 3px 3px;
  border-radius: 20px; cursor: pointer;
}
.top-avatar-wrap:hover { background: var(--hover); }
.avatar-letter {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #6d8bff, #1a73e8);
  color: #fff; font-size: 12px; font-weight: 600;
}
.avatar-vip {
  font-size: 8px; font-weight: 700; letter-spacing: .3px;
  color: #b26a00; background: #fef7e0; border-radius: 3px; padding: 1px 3px;
}

/* ============================ 工具栏 ============================ */
#main-toolbar {
  display: flex; align-items: center; gap: 4px;
  padding: 0 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.tb-btn {
  height: 28px; padding: 0 10px;
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: #3c4043; font-size: 12px;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.tb-btn .msr { font-size: 16px; color: #5f6368; }
.tb-btn:hover { background: var(--hover); }
.tb-btn:disabled { opacity: .42; cursor: default; background: transparent; }
.tb-btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 1px 2px rgba(91,124,250,.35); }
.tb-btn.primary .msr { color: #fff; }
.tb-btn.primary:hover { background: #4c6ff5; }
.tb-btn.danger { background: var(--red-soft); border-color: #f6cfcb; color: var(--red-ink); }
.tb-btn.danger .msr { color: var(--red-ink); }
.tb-btn.danger:hover { background: #fad2cf; }
.tb-btn.ghost { color: var(--muted); }
.tb-sep { width: 1px; height: 18px; background: var(--line); margin: 0 6px; }
.tb-spacer { flex: 1; }

/* ============================ 主体三栏 ============================ */
#body {
  display: grid;
  grid-template-columns: 216px 362px minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

/* ---------- 左：分组树 ---------- */
#sidebar {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 8px;
  background: var(--bg);
  border-right: 1px solid var(--line);
  min-height: 0;
}
.compose-btn {
  height: 34px; border-radius: 8px; border: none;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--blue); color: #fff; font-size: 13px; font-weight: 500;
  box-shadow: 0 1px 3px rgba(91, 124, 250, .35);
  transition: background .15s;
}
.compose-btn:hover { background: #4c6ff5; }
.compose-btn .msr { font-size: 17px; }
.sidebar-mgmt {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px; margin-top: 2px;
}
.sidebar-title { font-size: 11px; color: var(--muted); letter-spacing: .3px; }
.mini-icon {
  width: 22px; height: 22px; border-radius: 5px;
  display: grid; place-items: center;
  border: none; background: transparent; color: #5f6368;
}
.mini-icon:hover { background: var(--hover); color: var(--text); }
.mini-icon .msr { font-size: 16px; }
.sidebar-tree { flex: 1; overflow: auto; min-height: 0; }

.tree-item {
  position: relative;
  display: flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 8px; border-radius: 6px;
  color: #3c4043; font-size: 12.5px; cursor: pointer;
  transition: background .15s;
}
.tree-item:hover { background: #edf0f6; }
.tree-item.active { background: var(--blue-soft); color: var(--blue-ink); font-weight: 600; }
.tree-item .msr { font-size: 16px; color: #6b7280; }
.tree-item.active .msr { color: var(--blue-ink); }
.tree-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-count {
  font-size: 10px; color: var(--muted); background: #e9edf4;
  border-radius: 9px; padding: 0 6px; font-variant-numeric: tabular-nums;
}
.tree-item.active .tree-count { background: #fff; color: var(--blue-ink); }
.tree-actions { display: none; gap: 1px; margin-left: 3px; }
.tree-item:hover .tree-actions { display: flex; }
.tree-act {
  width: 18px; height: 18px; border-radius: 4px;
  display: grid; place-items: center;
  border: none; background: transparent; color: #5f6368;
}
.tree-act:hover { background: #dde3ec; color: var(--text); }
.tree-act .msr { font-size: 13px; }

/* ---------- 中：账号表 ---------- */
#panel-accounts {
  display: flex; flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
  min-height: 0;
}
.panel-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--line);
}
.ph-title { font-size: 13px; font-weight: 600; }
.ph-count { font-size: 11px; color: var(--muted); }
.ph-actions { margin-left: auto; display: flex; gap: 2px; }

.acc-filter-bar { padding: 7px 10px; border-bottom: 1px solid var(--line); }
.acc-filter-input {
  width: 100%; height: 28px;
  border: 1px solid var(--line); border-radius: 6px;
  background: #f8fafd; padding: 0 10px;
  font-size: 12px; color: var(--text); outline: none;
}
.acc-filter-input:focus { background: #fff; border-color: var(--blue); }

.accounts-table { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.acc-head {
  display: grid; grid-template-columns: 22px 20px minmax(0, 1fr) 60px 32px;
  gap: 6px; padding: 6px 10px;
  font-size: 10.5px; color: var(--muted);
  background: #fafbfd; border-bottom: 1px solid var(--line);
}
.acc-rows { flex: 1; overflow: auto; }

.acc-row {
  position: relative;
  display: grid; grid-template-columns: 22px 20px minmax(0, 1fr) 60px 32px;
  gap: 6px; align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid #f1f3f6;
  cursor: pointer;
  transition: background .12s;
}
.acc-check { display: flex; align-items: center; justify-content: center; }
.acc-check input { width: 13px; height: 13px; accent-color: var(--blue); cursor: pointer; }

/* 批量操作条 */
.sel-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  background: #eef4ff; border-bottom: 1px solid #d6e4ff;
}
.sel-count { font-size: 11.5px; color: var(--blue-ink); font-weight: 600; white-space: nowrap; }
.sel-user { height: 28px; padding: 0 8px; font-size: 11.5px; flex: 1; min-width: 0; }
.sel-bar .btn { height: 26px; }
.acc-row:hover { background: #f7f9fc; }
.acc-row.active { background: var(--blue-soft); }
.acc-row.fetching { background: #f3f7ff; }
.acc-idx { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.acc-mail { display: flex; align-items: center; gap: 7px; min-width: 0; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #c4cbd6; flex: none; }
.dot.ok { background: var(--green); box-shadow: 0 0 0 3px rgba(52,168,83,.12); }
.dot.error, .dot.auth_error { background: var(--red); box-shadow: 0 0 0 3px rgba(234,67,53,.12); }
.dot.new { background: var(--amber); }
.acc-info { min-width: 0; }
.acc-email { font-size: 11.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-sub { display: flex; align-items: center; gap: 5px; margin-top: 1px; font-size: 10px; color: var(--muted); }
.badge {
  font-size: 8.5px; font-weight: 700; letter-spacing: .3px;
  padding: 0 4px; border-radius: 3px;
  background: #e8f0fe; color: #1a73e8;
}
.badge.gmail { background: #fce8e6; color: var(--red-ink); }
.badge.imap { background: #f3e8fd; color: #7627bb; }
.acc-group {
  font-size: 10.5px; color: var(--text-2);
  background: var(--hover); border-radius: 4px; padding: 1px 5px;
  text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acc-count { font-size: 11px; color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; }
.acc-codehint { color: var(--green); }
.acc-move {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 5px;
  display: none; place-items: center;
  border: 1px solid var(--line-2); background: #fff; color: #5f6368;
  font-size: 11px;
}
.acc-own {
  position: absolute; right: 27px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 5px;
  display: none; place-items: center;
  border: 1px solid var(--line-2); background: #fff; color: var(--blue-ink);
}
.acc-own .msr { font-size: 13px; }
.acc-row:hover .acc-move, .acc-row:hover .acc-own { display: grid; }
.acc-move:hover { background: var(--blue-soft); color: var(--blue-ink); border-color: #b6d0fa; }
.acc-own:hover { background: var(--blue-soft); border-color: #b6d0fa; }

.users-hint {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 9px 11px; margin-bottom: 8px;
  background: #f1f6ff; border: 1px solid #d6e4ff; border-radius: 8px;
  font-size: 11.5px; color: #3c4043; line-height: 1.65;
}
.users-hint .msr { font-size: 16px; color: var(--blue-ink); margin-top: 1px; }
.spin {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid #d7e4ff; border-top-color: var(--blue);
  animation: spin .7s linear infinite; display: inline-block;
}

/* ---------- 右：邮件 / 验证码 ---------- */
#panel-right { display: flex; flex-direction: column; min-height: 0; background: var(--panel); }

#right-tabs {
  display: flex; align-items: center; gap: 2px;
  height: 38px; padding: 0 8px;
  border-bottom: 1px solid var(--line);
}
.rt-tab {
  height: 100%; padding: 0 12px;
  display: inline-flex; align-items: center; gap: 5px;
  border: none; background: transparent; color: var(--text-2);
  font-size: 12.5px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.rt-tab .msr { font-size: 16px; }
.rt-tab:hover { color: var(--text); background: #f8fafd; }
.rt-tab.active { color: var(--blue-ink); border-bottom-color: var(--blue-ink); font-weight: 600; }

.tab-content { display: none; flex: 1; flex-direction: column; min-height: 0; }
.tab-content.active { display: flex; }

.mail-toolbar {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-bottom: 1px solid var(--line);
}
.chip-filter {
  height: 24px; padding: 0 10px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; color: var(--text-2);
  font-size: 11.5px;
}
.chip-filter:hover { background: var(--hover); }
.chip-filter.active { background: var(--blue-soft); border-color: #b6d0fa; color: var(--blue-ink); font-weight: 600; }

.mail-table { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.mail-head {
  display: grid; grid-template-columns: 12px 106px 100px minmax(0, 1fr) 84px 72px;
  gap: 8px; padding: 6px 12px;
  font-size: 10.5px; color: var(--muted);
  background: #fafbfd; border-bottom: 1px solid var(--line);
}
.mail-rows { flex: 1; overflow: auto; }
.mail-row {
  display: grid; grid-template-columns: 12px 106px 100px minmax(0, 1fr) 84px 72px;
  gap: 8px; align-items: center;
  padding: 7px 12px; border-bottom: 1px solid #f1f3f6;
  cursor: pointer; transition: background .12s;
}
.mail-row:hover { background: #f7f9fc; }
.mail-row.active { background: #e8f0fe; }
.mail-dot { width: 7px; height: 7px; border-radius: 50%; background: #c4cbd6; }
.mail-dot.hot { background: var(--green); box-shadow: 0 0 0 3px rgba(52,168,83,.12); }
.mail-acc, .mail-from { font-size: 11px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-main { min-width: 0; }
.mail-subj { font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row.has-code .mail-subj { font-weight: 600; }
.mail-snip { font-size: 10.5px; color: #9aa0a6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.mail-time { font-size: 10.5px; color: #9aa0a6; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.code-pill {
  justify-self: start;
  font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .4px;
  color: var(--green-ink); background: var(--green-soft);
  border: 1px solid #ceead6; border-radius: 4px;
  padding: 2px 6px; white-space: nowrap;
}
.code-pill[data-copy] { cursor: pointer; }
.code-pill[data-copy]:hover { background: #ceead6; }
.code-pill.none { background: transparent; border-color: transparent; color: #d0d6de; }
.code-pill.lg { font-size: 12px; padding: 3px 9px; cursor: pointer; }

/* 验证码卡片网格 */
.code-grid {
  flex: 1; overflow: auto; padding: 12px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(222px, 1fr));
  gap: 10px; align-content: start;
}
.code-card {
  padding: 10px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.code-card:hover { border-color: #b6d0fa; box-shadow: 0 2px 8px rgba(32,33,36,.08); }
.code-card.fresh { border-color: #ceead6; animation: pop .7s ease; }
.code-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 10.5px; color: var(--muted); }
.code-proj {
  color: var(--blue-ink); background: #e8f0fe; border-radius: 4px; padding: 0 5px;
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.code-value { font-family: var(--mono); font-size: 22px; font-weight: 700; color: #0d652d; letter-spacing: 1.5px; margin: 4px 0 2px; }
.code-email, .code-subj { font-size: 10.5px; color: #9aa0a6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 空态 */
.empty, .empty-tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 40px 20px; color: var(--muted); font-size: 12px; text-align: center;
}
.empty-tab .msr { font-size: 34px; color: #dadce0; }

/* ============================ 状态栏 ============================ */
#statusbar {
  display: flex; align-items: center;
  height: 26px; padding: 0 6px;
  background: var(--status-bg); border-top: 1px solid var(--line);
  font-size: 11px; color: var(--text-2);
}
.sb-item { display: inline-flex; align-items: center; gap: 4px; padding: 0 9px; height: 100%; }
.sb-item .msr { font-size: 13px; color: #80868b; }
.sb-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.sb-dot.g { background: var(--green); }
.sb-dot.r { background: var(--red); }
.sb-dot.n { background: #9aa0a6; }
.sb-spacer { flex: 1; }
.sb-scope { color: #3c4043; }
.sb-ver { padding: 0 10px; font-size: 10px; color: #9aa0a6; }

/* ============================ 抽屉 / 弹窗 ============================ */
.drawer {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(32, 33, 36, .32);
  display: none; justify-content: flex-end;
}
.drawer.open { display: flex; }
.drawer-card {
  width: min(680px, 100%); height: 100%;
  display: flex; flex-direction: column;
  background: #fff; box-shadow: -8px 0 24px rgba(32,33,36,.12);
}
.drawer-head { padding: 14px 18px 12px; border-bottom: 1px solid var(--line); }
.drawer-subj { font-size: 14px; font-weight: 600; margin-bottom: 6px; word-break: break-word; }
.drawer-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 11px; color: var(--muted); }
.drawer-body {
  flex: 1; overflow: auto; padding: 16px 18px;
  white-space: pre-wrap; word-break: break-word;
  font-size: 12.5px; line-height: 1.7; color: #3c4043;
}
.drawer-foot { padding: 10px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; }

.modal {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(32, 33, 36, .32);
  display: none; place-items: center; padding: 20px;
}
.modal.open { display: grid; }
.modal-card {
  width: min(680px, 100%);
  background: #fff; border-radius: 12px; padding: 18px 20px;
  box-shadow: 0 12px 40px rgba(32, 33, 36, .22);
}
.modal-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.modal-sub { font-size: 11.5px; color: var(--muted); line-height: 1.7; margin-bottom: 12px; }
.modal-sub code {
  font-family: var(--mono); font-size: 10.5px;
  background: var(--hover); border-radius: 3px; padding: 1px 4px; color: var(--blue-ink);
}
.modal-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; }

.input {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--line-2); border-radius: 6px;
  background: #fff; color: var(--text); font-size: 12px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(91,124,250,.12); }
textarea.input { min-height: 150px; resize: vertical; font-family: var(--mono); line-height: 1.6; }

.btn {
  height: 30px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  border: 1px solid var(--line-2); border-radius: 6px;
  background: #fff; color: #3c4043; font-size: 12px;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #4c6ff5; }
.btn.danger { background: var(--red-soft); border-color: #f6cfcb; color: var(--red-ink); }
.btn-block { width: 100%; height: 34px; }

.import-result {
  margin-top: 10px; padding: 8px 10px;
  background: #f8fafd; border: 1px solid var(--line); border-radius: 6px;
  font-size: 11px; color: #3c4043; white-space: pre-wrap;
  max-height: 150px; overflow: auto;
}
.import-result:empty { display: none; }
.import-result .bad { color: var(--red); }

/* 移动分组菜单 */
.move-menu {
  position: fixed; z-index: 80; width: 208px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow-pop); padding: 4px;
  max-height: 70vh; overflow: auto;
  animation: fadeIn .12s ease;
}
.move-head {
  font-size: 10px; letter-spacing: .6px; text-transform: uppercase;
  color: var(--muted); padding: 5px 8px 6px;
  border-bottom: 1px solid var(--line); margin-bottom: 3px;
}
.move-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 6px 8px; border: none; border-radius: 6px;
  background: transparent; color: #3c4043; font-size: 12px; text-align: left;
}
.move-item:hover { background: var(--hover); }
.move-item.cur { background: var(--blue-soft); color: var(--blue-ink); font-weight: 600; }
.move-item.new { color: var(--blue-ink); border-top: 1px solid var(--line); border-radius: 0 0 6px 6px; margin-top: 3px; }
.mv-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-count { font-size: 10px; color: var(--muted); }
.mv-tick { font-size: 9px; background: #fff; color: var(--blue-ink); padding: 0 4px; border-radius: 3px; }
.move-empty { padding: 8px; font-size: 11.5px; color: var(--muted); }

/* toast */
#toasts { position: fixed; right: 16px; bottom: 34px; display: flex; flex-direction: column; gap: 8px; z-index: 90; }
.toast {
  background: #323232; color: #fff; font-size: 12px;
  padding: 9px 13px; border-radius: 6px; max-width: 340px;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  animation: fadeIn .18s ease;
}
.toast.ok { background: var(--green-ink); }
.toast.bad { background: var(--red-ink); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop {
  0% { box-shadow: 0 0 0 0 rgba(52,168,83,.4); }
  100% { box-shadow: 0 0 0 12px rgba(52,168,83,0); }
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } }

/* 滚动条 */
.scroll-thin::-webkit-scrollbar { width: 9px; height: 9px; }
.scroll-thin::-webkit-scrollbar-thumb {
  background: #d6dbe3; border-radius: 8px; border: 2px solid transparent; background-clip: content-box;
}
.scroll-thin::-webkit-scrollbar-thumb:hover { background: #c2cad6; background-clip: content-box; }
.scroll-thin::-webkit-scrollbar-track { background: transparent; }

/* ============================ 登录页 ============================ */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: var(--bg);
}
.login-card {
  position: relative; overflow: hidden;
  width: 100%; max-width: 376px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 30px 28px 24px;
  box-shadow: 0 10px 30px rgba(32, 33, 36, .1);
}
.login-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, #6d8bff, #1a73e8);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #6d8bff, #1a73e8);
  color: #fff; font-weight: 800; font-size: 14px;
}
.brand-name { font-size: 15px; font-weight: 700; }
.login-sub { font-size: 11.5px; color: var(--muted); margin: 8px 0 20px; }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 11.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.hint { font-size: 11px; color: var(--muted); margin-top: 14px; line-height: 1.6; }
.err { min-height: 18px; margin-top: 8px; font-size: 11.5px; color: var(--red); }

/* ============================ 邮件规则 ============================ */
.rules-list { flex: 1; overflow: auto; padding: 10px 12px; }
.rules-hint {
  padding: 9px 12px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--muted); line-height: 1.65; background: #fafbfd;
}
.rules-hint b { color: var(--text-2); }

.rule-row {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto 26px 26px;
  gap: 10px; align-items: center;
  padding: 9px 10px; margin-bottom: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  transition: border-color .15s, box-shadow .15s;
}
.rule-row:hover { border-color: #c9d8f5; box-shadow: 0 1px 6px rgba(32,33,36,.06); }
.rule-row.off { opacity: .55; background: #fafbfd; }
.rule-main { min-width: 0; }
.rule-name { font-size: 12.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-cond { font-size: 10.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-cond code {
  font-family: var(--mono); font-size: 10px; color: var(--blue-ink);
  background: #e8f0fe; border-radius: 3px; padding: 0 4px;
}
.rule-action {
  font-size: 10.5px; padding: 2px 7px; border-radius: 4px; white-space: nowrap;
  background: var(--hover); color: var(--text-2);
}
.rule-action.ignore { background: #fce8e6; color: var(--red-ink); }
.rule-action.project { background: #e6f4ea; color: var(--green-ink); }
.rule-action.group { background: #e8f0fe; color: var(--blue-ink); }
.rule-hits { font-size: 10.5px; color: var(--muted); white-space: nowrap; }

/* 开关 */
.rule-switch { position: relative; display: inline-flex; align-items: center; justify-content: flex-start; width: 30px; height: 16px; cursor: pointer; }
.rule-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.rule-knob {
  width: 30px; height: 16px; border-radius: 16px; background: #dadce0;
  position: relative; transition: background .15s;
}
.rule-knob::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s;
}
.rule-switch input:checked + .rule-knob { background: var(--blue); }
.rule-switch input:checked + .rule-knob::after { transform: translateX(14px); }

/* 预设 */
.rule-presets { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 4px; }
.rule-preset {
  height: 28px; padding: 0 12px; border-radius: 14px;
  border: 1px solid var(--line); background: #fff; color: var(--blue-ink);
  font-size: 11.5px;
}
.rule-preset:hover { background: var(--search-bg); border-color: #b6d0fa; }

/* 规则表单 */
.rule-form { display: flex; flex-direction: column; gap: 10px; }
.rule-field { display: flex; flex-direction: column; gap: 5px; }
.rule-field > span { font-size: 11px; color: var(--text-2); }
.rule-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rule-check { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-2); }
select.input { height: 32px; padding: 0 8px; background: #fff; }
#rule-msg:empty { display: none; }

/* ============================ 用户与权限 ============================ */
.user-menu {
  position: fixed; z-index: 85; width: 196px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-pop); padding: 5px;
  animation: fadeIn .12s ease;
}
.um-head {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 8px 9px 9px; border-bottom: 1px solid var(--line); margin-bottom: 4px;
  font-size: 12px; color: var(--text);
}
.um-head b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-head span { font-size: 10px; color: var(--muted); background: var(--hover); padding: 1px 6px; border-radius: 10px; white-space: nowrap; }
.um-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 9px; border: none; border-radius: 6px;
  background: transparent; color: #3c4043; font-size: 12px; text-align: left;
}
.um-item:hover { background: var(--hover); }
.um-item .msr { font-size: 16px; color: #5f6368; }
.um-item[hidden] { display: none; }

.modal-card.wide { width: min(760px, 100%); }
.users-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.users-list { max-height: 46vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.user-row {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto 24px 24px 24px;
  gap: 9px; align-items: center;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
}
.user-row.off { opacity: .55; background: #fafbfd; }
.u-initial {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #6d8bff, #1a73e8); color: #fff;
  font-size: 12px; font-weight: 600;
}
.u-main { min-width: 0; }
.u-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-login { font-size: 10.5px; color: var(--muted); font-weight: 400; }
.u-meta { display: flex; gap: 8px; align-items: center; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.u-role { font-size: 9.5px; font-weight: 700; padding: 0 5px; border-radius: 3px; }
.u-role.admin { background: #e8f0fe; color: var(--blue-ink); }
.u-role.member { background: #f1f3f4; color: var(--text-2); }
.u-allscope {
  font-size: 11px; color: var(--blue-ink); background: #e8f0fe;
  border-radius: 4px; padding: 3px 10px; height: 26px;
  display: inline-flex; align-items: center;
}
.btn.sm .msr { font-size: 15px; }

.assign-list { max-height: 42vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.assign-row {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) 80px 72px;
  gap: 8px; align-items: center;
  padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 12px;
}
.assign-row:hover { background: var(--hover); }
.assign-row.taken { color: var(--muted); }
.assign-row input { accent-color: var(--blue); }
.assign-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assign-group { font-size: 10.5px; color: var(--text-2); background: var(--hover); border-radius: 4px; padding: 1px 5px; text-align: center; }
.assign-owner { font-size: 10px; color: var(--muted); text-align: right; }

.acc-owner {
  font-size: 9.5px; color: var(--blue-ink); background: #e8f0fe;
  border-radius: 3px; padding: 0 4px;
}
.acc-owner.none { color: #9aa0a6; background: #f1f3f4; }

/* ============================ 响应式 ============================ */
@media (max-width: 1240px) {
  #body { grid-template-columns: 196px 310px minmax(0, 1fr); }
  .mail-head, .mail-row { grid-template-columns: 12px 92px 84px minmax(0, 1fr) 78px 64px; }
}
@media (max-width: 1024px) {
  #body { grid-template-columns: 176px minmax(0, 1fr); }
  #panel-accounts { display: none; }
  .mail-head, .mail-row { grid-template-columns: 12px 100px 92px minmax(0, 1fr) 78px 64px; }
}

