﻿/* ============================================================
   style.css — 全局设计系统（Light/Dark 双主题）
   字体: system-ui | 圆角卡片 | 柔阴影 | 响应式
   ============================================================ */

/* ── 主题变量 ── */
:root {
  --bg-primary: #f8f9fc;
  --bg-card: #fff;
  --bg-hover: #f1f5f9;
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-bg: rgba(99, 102, 241, .08);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .08);
  --radius: 12px;
  --sidebar-w: 220px;
  --sidebar-collapsed: 60px;
  --topbar-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

body.dark-mode {
  --bg-primary: #09090b;
  --bg-card: #18181b;
  --bg-hover: #27272a;
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #818cf8;
  --accent-light: #a5b4fc;
  --accent-bg: rgba(129, 140, 248, .12);
  --border: #27272a;
  --shadow: 0 1px 3px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .5);
}

/* ── 基础 ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background .3s, color .3s;
  /* 开启抗锯齿，文字边缘更清晰锐利 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none
}

a:hover {
  color: var(--accent-light)
}

img {
  max-width: 100%
}

/* ── 侧边栏 ── */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width .3s;
  z-index: 100;
  overflow: hidden
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed)
}

.sidebar-logo {
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  border-bottom: 1px solid var(--border)
}

.sidebar-logo span {
  transition: opacity .2s
}

.sidebar.collapsed .sidebar-logo span {
  opacity: 0;
  width: 0
}

.sidebar-nav {
  flex: 1;
  padding: 10px 8px
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  margin: 2px 0;
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  font-size: 14px
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary)
}

.nav-item.active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent)
}

.nav-item .icon {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  font-size: 16px
}

.nav-item .label {
  transition: opacity .2s
}

.sidebar.collapsed .nav-item .label {
  opacity: 0;
  width: 0;
  overflow: hidden
}

.sidebar-toggle {
  padding: 14px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  text-align: center;
  color: var(--text-secondary);
  font-size: 18px
}

.sidebar-toggle:hover {
  background: var(--bg-hover)
}

/* ── 顶部栏 ── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 90;
  transition: left .3s
}

/* ── 圆角内容区交界处理（反向圆角） ── */
.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -24px;
  width: 24px;
  height: 24px;
  background: transparent;
  border-top-left-radius: 24px;
  box-shadow: -10px -10px 0 10px var(--bg-card);
  pointer-events: none;
  z-index: 89;
}

.sidebar.collapsed~.main-wrap .topbar {
  left: var(--sidebar-collapsed)
}

.topbar-title {
  font-size: 18px;
  font-weight: 600
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px
}

.topbar-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: var(--bg-hover);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .2s
}

.topbar-btn i,
.topbar-btn svg {
  width: 18px;
  height: 18px;
}

.topbar-btn:hover {
  background: var(--accent-bg);
  color: var(--accent)
}

/* ── 主内容区 ── */
.main-wrap {
  margin-left: var(--sidebar-w);
  transition: margin-left .3s
}

.sidebar.collapsed~.main-wrap {
  margin-left: var(--sidebar-collapsed)
}

.content {
  padding: calc(var(--topbar-h) + 28px) 32px 32px
}

/* ── 卡片 ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: .2s
}

.card:hover {
  box-shadow: var(--shadow-md)
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px
}

.card-title {
  font-size: 16px;
  font-weight: 600
}

/* ── 统计卡片 ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px 28px
}

.stat-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.5px
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px
}

/* ── 按钮 ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font);
  transition: .2s;
  white-space: nowrap
}

.btn i,
.btn svg {
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  margin-right: 6px;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent)
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent)
}

.btn-primary:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
  color: #fff
}

.btn-danger {
  border-color: var(--danger);
  color: var(--danger)
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed
}

/* ── 表格 ── */
.table-wrap {
  overflow-x: auto
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px
}

th {
  background: var(--bg-hover);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top
}

tr:hover td {
  background: var(--bg-hover)
}

tr.expanded-row td {
  background: var(--accent-bg);
  border-bottom: none
}

.detail-panel {
  padding: 16px;
  background: var(--accent-bg);
  border-bottom: 1px solid var(--border);
  font-size: 13px
}

/* ── 表单 ── */
.form-group {
  margin-bottom: 14px
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text-secondary)
}

.form-input,
.form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
  transition: .2s;
  outline: none
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg)
}

.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end
}

.form-row .form-group {
  flex: 1;
  min-width: 140px;
  margin-bottom: 0
}

/* ── 搜索/筛选栏 ── */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius)
}

.filter-bar .form-input,
.filter-bar .form-select {
  width: auto;
  min-width: 120px;
  flex: 1;
  padding: 7px 10px;
  font-size: 13px
}

/* ── Tab 组件 ── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px
}

.tab {
  padding: 10px 20px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: .2s
}

.tab:hover {
  color: var(--text-primary)
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent)
}

/* ── 分页 ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px
}

.page-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  cursor: pointer;
  font-size: 13px;
  transition: .2s
}

.page-btn:hover {
  border-color: var(--accent);
  color: var(--accent)
}

.page-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent)
}

.page-btn:disabled {
  opacity: .4;
  cursor: not-allowed
}

/* ── 进度条 ── */
.progress-bar {
  height: 8px;
  background: var(--bg-hover);
  border-radius: 4px;
  overflow: hidden;
  flex: 1
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  transition: width .4s
}

/* ── 模态弹窗 ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: .2s
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px;
  width: 90%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  transform: scale(.95);
  transition: .2s
}

.modal-overlay.show .modal {
  transform: scale(1)
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 14px
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px
}

/* ── 提示消息 ── */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  z-index: 300;
  transform: translateX(120%);
  transition: .3s;
  max-width: 360px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .15)
}

.toast.show {
  transform: translateX(0)
}

.toast-success {
  background: var(--success)
}

.toast-error {
  background: var(--danger)
}

.toast-info {
  background: var(--info)
}

/* ── 加载 ── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

/* ── 快捷操作网格 ── */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px
}

.action-card {
  padding: 22px;
  text-align: center;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  transition: all .25s
}

.action-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px)
}

.action-card .icon {
  font-size: 28px;
  margin-bottom: 10px
}

.action-card .label {
  font-size: 14px;
  font-weight: 500
}

/* ── 系统状态面板 ── */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px
}

.status-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0
}

.status-dot.green {
  background: var(--success);
  box-shadow: 0 0 6px var(--success)
}

.status-dot.yellow {
  background: var(--warning);
  box-shadow: 0 0 6px var(--warning)
}



/* ── 登录页 ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%)
}

.login-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 40px;
  width: 90%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .15)
}

.login-card h1 {
  text-align: center;
  font-size: 24px;
  margin-bottom: 4px;
  color: var(--text-primary)
}

.login-card .subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 28px
}

.login-error {
  background: rgba(239, 68, 68, .1);
  color: var(--danger);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
  display: none
}

/* ── 顶栏内联工具 ── */
.topbar-tab {
  padding: 0 14px;
  height: 100%;
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: .15s;
  white-space: nowrap
}

.topbar-tab:hover {
  color: var(--text-primary)
}

.topbar-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent)
}

.topbar-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px
}

.tb-input {
  padding: 4px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  width: 180px;
  font-family: var(--font)
}

.tb-input:focus {
  outline: none;
  border-color: var(--accent)
}

.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font);
  transition: .15s
}

.tb-btn i,
.tb-btn svg {
  width: 14px;
  height: 14px
}

.tb-btn:hover {
  border-color: var(--accent);
  color: var(--accent)
}

.tb-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent)
}

.tb-primary:hover {
  opacity: .85;
  color: #fff
}

.tb-danger {
  color: var(--danger);
  border-color: var(--danger)
}

.tb-danger:hover {
  background: var(--danger);
  color: #fff
}

.tb-danger:disabled {
  opacity: .4;
  pointer-events: none
}

.tb-info {
  color: var(--info);
  border-color: var(--info)
}

.tb-info:hover {
  background: var(--info);
  color: #fff
}

.tb-select {
  padding: 3px 6px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font)
}

.tb-pager {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap
}

/* ── 收件箱双栏布局 ── */
.ix-wrap {
  display: flex;
  height: calc(100vh - var(--topbar-h) - 60px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card)
}

.ix-left {
  width: 20%;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  background: #f8f9fb;
  border-right: none;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
  z-index: 1;
  position: relative
}

.ix-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-left: none;
  will-change: transform
}

body.dark-mode .ix-left {
  background: #1e1e22;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15)
}

body.dark-mode .ix-right {
  background: #18181b
}

/* 左栏：账号 */
.ix-account {
  padding: 12px;
  border-bottom: 1px solid var(--border)
}

.ix-account .form-select {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 8px
}

.ix-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px
}

/* 左栏：列表 */
.ix-list {
  flex: 1;
  overflow-y: auto
}

.ix-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 12px 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s
}

.ix-item:hover {
  background: var(--bg-hover)
}

.ix-item.active {
  background: var(--accent-bg)
}

.ix-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0
}

.ix-cb {
  margin-top: 3px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--accent)
}

.ix-item-body {
  flex: 1;
  min-width: 0
}

.ix-row1 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px
}

.ix-subj {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary)
}

.ix-time {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0
}

.ix-sender {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px
}

.ix-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--border);
  background: var(--bg-card)
}

.ix-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 14px
}

/* 右栏：工具栏 */
.ix-toolbar {
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  padding: 10px 14px
}

.ix-toolbar-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap
}

.ix-toolbar-row .form-input {
  flex: 1;
  min-width: 100px;
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 8px
}

.ix-toolbar-row2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-end
}

.ix-toolbar-row2 .form-select {
  padding: 4px 6px;
  font-size: 12px;
  border-radius: 6px
}

.ix-pager-mini {
  font-size: 12px;
  color: var(--text-muted)
}

/* Pill 筛选按钮 */
.ix-pill {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: .2s;
  white-space: nowrap
}

.ix-pill:hover {
  border-color: var(--accent);
  color: var(--accent)
}

.ix-pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent)
}

/* 右栏：预览 - 始终预留滚动条位置防抖动 */
.ix-preview {
  flex: 1;
  overflow-y: overlay;
  scrollbar-gutter: stable
}

.dt-iframe {
  border: none;
  width: 100%
}

.ix-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  color: var(--text-muted);
  font-size: 15px
}

/* 邮件详情 */
.dt-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card)
}

.dt-subject {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 14px
}

.dt-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  color: var(--text-secondary)
}

.dt-body {
  padding: 24px
}

.dt-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.6;
  font-family: var(--font);
  margin: 0
}

.dt-iframe {
  width: 100%;
  border: none;
  min-height: 200px
}

@media(max-width:768px) {

  /* 全屏层叠覆盖式布局 */
  .ix-wrap {
    position: relative;
    overflow: hidden;
    flex-direction: row;
    height: calc(100vh - 120px)
  }

  .ix-left {
    width: 100% !important;
    min-width: 0;
    max-height: none;
    height: 100%;
    flex-shrink: 0;
    border-right: none;
    border-bottom: none;
    transition: transform .3s cubic-bezier(.25, .8, .25, 1)
  }

  .ix-right {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100%;
    z-index: 10;
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.25, .8, .25, 1);
    box-shadow: -5px 0 15px rgba(0, 0, 0, .05)
  }

  /* 激活详情页 */
  .ix-wrap.show-detail .ix-left {
    transform: translateX(-30%)
  }

  .ix-wrap.show-detail .ix-right {
    transform: translateX(0)
  }

  .ix-toolbar-row {
    flex-wrap: wrap
  }

  /* 手机返回按钮 */
  .mobile-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    padding: 6px 10px 6px 0;
    margin-right: 10px;
    color: var(--accent);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer
  }

  .mobile-back-btn svg {
    width: 18px;
    height: 18px
  }
}

/* 电脑端隐藏手机返回按钮和菜单按钮 */
@media(min-width:769px) {
  .mobile-back-btn {
    display: none !important
  }
}

/* ── 汉堡菜单按钮 ── */
.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  margin-right: 8px
}

.mobile-menu-btn:hover {
  background: var(--border)
}

.mobile-menu-btn svg {
  width: 22px;
  height: 22px
}

/* ── 移动端侧边栏覆盖层 ── */
@media(max-width:768px) {
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px !important;
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.25, .8, .25, 1);
    z-index: 1000;
    box-shadow: none;
    will-change: transform
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0, 0, 0, .15)
  }

  /* 强制忽略桌面端的 collapsed 状态 */
  .sidebar.collapsed {
    width: 260px !important;
    transform: translateX(-100%)
  }

  body.sidebar-open .sidebar.collapsed {
    transform: translateX(0)
  }

  /* 顶栏和内容区不再偏移 */
  .topbar {
    left: 0 !important
  }

  .sidebar.collapsed~.main-wrap .topbar {
    left: 0 !important
  }

  .main-wrap {
    margin-left: 0 !important
  }

  .sidebar-toggle {
    display: none
  }

  .stats-grid {
    grid-template-columns: 1fr
  }

  /* 确保侧边栏文字在移动端正常显示 */
  .sidebar .nav-item .label,
  .sidebar .sidebar-logo span {
    opacity: 1 !important;
    width: auto !important;
    overflow: visible !important
  }

  /* 内容区 padding 适配 */
  .content {
    padding: calc(var(--topbar-h) + 12px) 16px 16px
  }

  /* 顶栏工具区在手机端允许换行或横向滑动 */
  .topbar {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--topbar-h);
    padding: 8px 12px
  }

  /* 手机端隐藏搜索框、筛选按钮、批量操作按钮 */
  #topbarTools .tb-input,
  #topbarTools input[type="text"],
  #topbarTools .ix-pill,
  #topbarTools .tb-primary,
  #topbarTools .tb-danger,
  #topbarTools .tb-info {
    display: none !important
  }

  /* 只保留 Tab 切换和分页器，紧凑排列 */
  #topbarTools {
    margin-left: 0 !important;
    gap: 4px !important
  }

  .topbar-tab {
    padding: 0 8px;
    font-size: 12px
  }

  /* 邮件详情头部适配 */
  .dt-header {
    padding: 16px 12px
  }

  .dt-subject {
    font-size: 16px
  }

  .dt-meta {
    font-size: 12px
  }

  .dt-body {
    padding: 0
  }

  /* iframe 强制不超出屏幕 */
  .dt-iframe {
    width: 100% !important;
    max-width: 100vw
  }

  /* 所有表格可横向滚动 */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch
  }
}

/* ==================== 
   自定义全局细圆角滚动条 
==================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: #d1d5db;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #9ca3af;
}

/* 适配 Dark Mode 下的滚动条颜色（如果 body 有 dark-mode 类） */
body.dark-mode ::-webkit-scrollbar-thumb {
  background-color: #4b5563;
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
  background-color: #6b7280;
}

/* ══════════════════════
   全局加载过渡效果
══════════════════════ */
.loading-fade {
  opacity: .4;
  pointer-events: none;
  transition: opacity .15s ease
}

#globalProgress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, #6366f1, #a855f7);
  z-index: 9999;
  transition: width .3s ease;
  display: none
}

/* ── 邮件预览区 flex 布局（iframe 自动撑满） ── */
#ixPreview {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  scrollbar-gutter: stable
}

.dt-header {
  flex-shrink: 0
}

.dt-body {
  flex: 1;
  overflow: hidden;
  min-height: 0
}

.dt-iframe {
  width: 100%;
  height: 100%;
  border: none
}

/* ── 全局细圆角滚动条 ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px
}

::-webkit-scrollbar-track {
  background: transparent
}

::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 10px
}

::-webkit-scrollbar-thumb:hover {
  background: #9ca3af
}

.dark-mode ::-webkit-scrollbar-thumb {
  background: #4b5563
}

.dark-mode ::-webkit-scrollbar-thumb:hover {
  background: #6b7280
}

* {
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent
}

.dark-mode * {
  scrollbar-color: #4b5563 transparent
}

/* ── 隐藏滚动条（保留列表滚动条） ── */
#content,
.ix-right,
#ixPreview,
.card {
  scrollbar-width: none;
  -ms-overflow-style: none
}

#content::-webkit-scrollbar,
.ix-right::-webkit-scrollbar,
#ixPreview::-webkit-scrollbar,
.card::-webkit-scrollbar {
  display: none
}