/* ===================================
   Outlook 快速取件 - 纯白蓝 macOS 玻璃风
   =================================== */

/* --- CSS 变量 --- */
:root {
  /* 白蓝色系 */
  --bg-base: #e8edf5;
  --bg-gradient-1: #dce4f2;
  --bg-gradient-2: #e2eaf8;

  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-bg-hover: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-border-hover: rgba(255, 255, 255, 0.85);
  --glass-shadow: rgba(100, 120, 180, 0.08);

  --accent: #2563eb;
  --accent-light: #3b82f6;
  --accent-lighter: #93c5fd;
  --accent-bg: rgba(37, 99, 235, 0.08);
  --accent-glow: rgba(37, 99, 235, 0.2);

  --accent-2: #0ea5e9;
  --accent-2-glow: rgba(14, 165, 233, 0.15);

  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --imap-color: #e11d48;
  --imap-bg: rgba(225, 29, 72, 0.08);
  --graph-color: #059669;
  --graph-bg: rgba(5, 150, 105, 0.08);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.08);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.08);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.08);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  --shadow-md: 0 4px 16px rgba(100, 120, 180, 0.1), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 32px rgba(100, 120, 180, 0.15), 0 2px 8px rgba(0,0,0,0.05);

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- 重置 --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* --- 动态背景 --- */
.bg-animation {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(135deg, #e0e7ff 0%, #dbeafe 25%, #e0f2fe 50%, #ede9fe 75%, #e8edf5 100%);
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.6;
  animation: orbFloat 25s ease-in-out infinite;
}

.bg-orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(147, 197, 253, 0.5), transparent 70%);
  top: -15%; left: -10%;
}

.bg-orb-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(196, 181, 253, 0.4), transparent 70%);
  top: 40%; right: -10%;
  animation-delay: -8s;
}

.bg-orb-3 {
  width: 450px; height: 450px;
  background: radial-gradient(circle, rgba(165, 218, 255, 0.45), transparent 70%);
  bottom: -10%; left: 25%;
  animation-delay: -16s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(40px, -30px) scale(1.05); }
  50% { transform: translate(-25px, 25px) scale(0.95); }
  75% { transform: translate(20px, 40px) scale(1.03); }
}

/* --- 玻璃面板 --- */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* --- 容器 --- */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1680px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* --- 顶部栏 --- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.app-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.app-subtitle {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 3px;
}

.retention-notice {
  font-size: 1.2rem;
  color: #b45309;
  font-weight: 700;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--success-bg);
  border: 1px solid rgba(16, 185, 129, 0.15);
  font-size: 0.78rem;
  color: var(--success);
  font-weight: 500;
}

.status-badge.loading {
  background: var(--warning-bg);
  border-color: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.status-badge.error {
  background: var(--error-bg);
  border-color: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* --- 主布局 --- */
.main-layout {
  display: flex;
  gap: 14px;
  flex: 1;
  min-height: 0;
}

/* --- 左侧面板 --- */
.sidebar {
  width: 360px;
  min-width: 360px;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
  max-height: calc(100vh - 110px);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.panel-title svg { opacity: 0.5; }

.account-search {
  position: relative;
  display: flex;
  align-items: center;
}

.account-search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.account-search-input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.68);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.82rem;
  outline: none;
  transition: var(--transition-fast);
}

.account-search-input:focus {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background: rgba(255, 255, 255, 0.9);
}

.account-search-input::placeholder {
  color: var(--text-muted);
}

.badge {
  background: var(--accent-bg);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-imap {
  background: var(--imap-bg);
  color: var(--imap-color);
}

.badge-graph {
  background: var(--graph-bg);
  color: var(--graph-color);
}

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  outline: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn-accent {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: white;
  box-shadow: 0 2px 10px rgba(14, 165, 233, 0.25);
}

.btn-accent:hover {
  box-shadow: 0 4px 18px rgba(14, 165, 233, 0.35);
  transform: translateY(-1px);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-secondary);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-primary);
}

.btn-full { width: 100%; }
.btn-small { padding: 6px 12px; font-size: 0.75rem; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* --- 邮箱列表 --- */
.import-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-right: 4px;
}

.account-list::-webkit-scrollbar { width: 4px; }
.account-list::-webkit-scrollbar-track { background: transparent; }
.account-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 4px;
}

.account-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
}

.account-item:hover {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(0, 0, 0, 0.04);
}

.account-item.selected {
  background: rgba(37, 99, 235, 0.06);
  border-color: rgba(37, 99, 235, 0.15);
}

.account-checkbox {
  appearance: none;
  width: 16px; height: 16px;
  border: 1.5px solid var(--text-muted);
  border-radius: 5px;
  cursor: pointer;
  transition: var(--transition-fast);
  flex-shrink: 0;
  position: relative;
  background: white;
}

.account-checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.account-checkbox:checked::after {
  content: '';
  position: absolute;
  top: 2px; left: 5px;
  width: 4px; height: 8px;
  border: solid white;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.account-email {
  font-size: 0.9rem;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}

.account-delete {
  opacity: 0;
  background: none;
  border: none;
  color: var(--error);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.account-copy {
  opacity: 0;
  width: 24px;
  height: 24px;
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.08);
  color: var(--accent);
  cursor: pointer;
  border-radius: 7px;
  transition: var(--transition-fast);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.account-item:hover .account-copy,
.account-item:focus-within .account-copy {
  opacity: 0.72;
}

.account-copy:hover {
  opacity: 1 !important;
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.18);
}

.account-item:hover .account-delete { opacity: 0.5; }
.account-delete:hover {
  opacity: 1 !important;
  background: var(--error-bg);
}

/* --- 空状态 --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-muted);
  gap: 6px;
  text-align: center;
}

.empty-state svg { opacity: 0.15; margin-bottom: 6px; }
.empty-state p { font-size: 0.82rem; }
.text-muted { color: var(--text-muted); font-size: 0.75rem; }

.sidebar-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding-top: 12px;
}

/* --- 右侧内容 --- */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* --- 搜索区 --- */
.control-panel {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-actions { justify-content: space-between; }
.flex-grow { flex: 1; }

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}

.input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.82rem;
  outline: none;
  transition: var(--transition-fast);
}

.input:focus {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
  background: rgba(255, 255, 255, 0.9);
}

.input::placeholder { color: var(--text-muted); }

.select {
  padding-left: 14px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

.input-narrow { width: 110px; min-width: 110px; }

/* --- 协议开关 --- */
.protocol-toggles {
  display: flex;
  gap: 8px;
}

.toggle-label { cursor: pointer; }
.toggle-label input { display: none; }

.toggle-pill {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.5);
  transition: var(--transition-fast);
}

.toggle-label input:checked + .toggle-pill {
  border-color: rgba(37, 99, 235, 0.25);
  color: var(--accent);
  background: rgba(37, 99, 235, 0.06);
}

.action-buttons { display: flex; gap: 8px; }

.token-refresh-panel {
  gap: 10px;
}

.token-refresh-header,
.token-refresh-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.token-refresh-header {
  justify-content: space-between;
}

.token-refresh-file {
  min-width: 240px;
  flex: 1;
}

.token-refresh-errors {
  min-height: 18px;
  margin-top: 8px;
  color: var(--error);
  font-size: 0.75rem;
  line-height: 1.4;
}

/* --- 进度条 --- */
.progress-bar-container {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.3s ease;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  margin-bottom: 10px;
  color: var(--text-secondary);
  font-weight: 500;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
  border-radius: 6px;
  transition: width 0.4s ease;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 1.5s infinite;
}

/* --- 结果区 --- */
.results-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
}

.results-title {
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.results-meta { display: flex; gap: 8px; }

/* --- 取件错误摘要 --- */
.fetch-issues {
  margin: 2px 0 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.18);
  color: var(--text-secondary);
}

.fetch-issues-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 8px;
}

.fetch-issues-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--warning);
}

.fetch-issues-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fetch-issue-item {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.65);
  overflow: hidden;
}

.fetch-issue-item summary {
  display: grid;
  grid-template-columns: auto minmax(120px, 220px) 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
  font-size: 0.76rem;
}

.fetch-issue-item summary::-webkit-details-marker {
  display: none;
}

.fetch-issue-email,
.fetch-issue-message {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fetch-issue-email {
  color: var(--text-primary);
  font-weight: 600;
}

.fetch-issue-message {
  color: var(--text-secondary);
}

.fetch-issue-item pre {
  margin: 0;
  padding: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  background: rgba(255, 255, 255, 0.55);
  color: var(--text-secondary);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.7rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* --- 邮件列表 --- */
.email-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.email-list::-webkit-scrollbar { width: 5px; }
.email-list::-webkit-scrollbar-track { background: transparent; }
.email-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.06);
  border-radius: 4px;
}

.email-card {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: var(--transition);
  animation: fadeInUp 0.35s ease forwards;
  opacity: 0;
  box-shadow: var(--shadow-sm);
}

.email-card:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.9);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.email-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.email-from {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.email-protocol {
  font-size: 0.62rem;
  padding: 1px 7px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.email-protocol.imap {
  background: var(--imap-bg);
  color: var(--imap-color);
}

.email-protocol.graph {
  background: var(--graph-bg);
  color: var(--graph-color);
}

.email-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.email-subject {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-preview {
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-account-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* --- 弹窗 --- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(148, 163, 184, 0.3);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
  width: 90%;
  max-width: 560px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(32px) saturate(1.5);
  -webkit-backdrop-filter: blur(32px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-large {
  max-width: 760px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  transition: var(--transition-fast);
  border-radius: 6px;
}

.btn-close:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.04);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
}

.modal-tip {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.modal-tip code {
  background: rgba(37, 99, 235, 0.06);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.75rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.textarea {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-primary);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  resize: vertical;
  outline: none;
  transition: var(--transition-fast);
  margin-top: 10px;
  line-height: 1.7;
}

.textarea:focus {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background: white;
}

.textarea::placeholder { color: var(--text-muted); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* --- 邮件详情 --- */
.email-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.04);
  margin-bottom: 14px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.email-detail-meta span { display: flex; gap: 8px; }
.email-detail-meta .meta-label {
  color: var(--text-muted);
  min-width: 50px;
}

.email-detail-body {
  padding: 14px;
  border-radius: 8px;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.04);
  font-size: 0.82rem;
  line-height: 1.7;
  max-height: 50vh;
  overflow-y: auto;
  word-break: break-word;
}

.email-detail-body img {
  max-width: 100%;
  border-radius: 8px;
}

.email-detail-body a { color: var(--accent); }

/* --- Toast --- */
.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-md);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 380px;
  color: var(--text-primary);
}

.toast.toast-exit { animation: toastOut 0.25s ease forwards; }

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--accent); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* --- 骨架屏 --- */
.skeleton {
  background: linear-gradient(90deg, rgba(0,0,0,0.02) 25%, rgba(0,0,0,0.05) 50%, rgba(0,0,0,0.02) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  height: 80px;
  margin-bottom: 8px;
  border-radius: var(--radius-md);
}

/* --- 全选 --- */
.select-all-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --- Badge 脉冲动画 --- */
.badge-pulse {
  animation: badgePulse 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes badgePulse {
  0% { transform: scale(1); }
  30% { transform: scale(1.3); background: var(--accent); color: white; }
  100% { transform: scale(1); }
}

/* --- 新导入账号高亮动画 --- */
.account-item-new {
  animation: accountSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards,
             accountHighlight 2s ease 0.4s forwards;
}

@keyframes accountSlideIn {
  from {
    opacity: 0;
    transform: translateX(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes accountHighlight {
  0% {
    background: rgba(37, 99, 235, 0.15);
    border-color: rgba(37, 99, 235, 0.3);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
  }
  100% {
    background: rgba(255, 255, 255, 0.35);
    border-color: transparent;
    box-shadow: none;
  }
}

/* --- 账号删除动画 --- */
.account-item-removing {
  animation: accountSlideOut 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes accountSlideOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
    max-height: 50px;
  }
  to {
    opacity: 0;
    transform: translateX(30px) scale(0.9);
    max-height: 0;
    padding: 0;
    margin: 0;
    border: 0;
    overflow: hidden;
  }
}

/* --- 批量删除按钮 --- */
.btn-danger-ghost {
  color: var(--error) !important;
  border-color: rgba(239, 68, 68, 0.15) !important;
}

.btn-danger-ghost:hover {
  background: var(--error-bg) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}

/* --- 按钮加载 Spinner --- */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Textarea 错误状态 --- */
.textarea-error {
  border-color: var(--error) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

/* --- 震动动画 --- */
.shake {
  animation: shakeAnim 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes shakeAnim {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-6px); }
  20% { transform: translateX(5px); }
  30% { transform: translateX(-4px); }
  40% { transform: translateX(3px); }
  50% { transform: translateX(-2px); }
  60% { transform: translateX(1px); }
}

/* --- 导入预览 --- */
.import-preview {
  padding: 8px 12px;
  margin-top: 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.04);
  font-size: 0.75rem;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}

.preview-hint {
  color: var(--text-muted);
}

.preview-count {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.preview-valid {
  color: var(--success);
  font-weight: 600;
}

.preview-dup {
  color: var(--warning);
  font-weight: 500;
}

.preview-error {
  color: var(--error);
  font-weight: 500;
}

/* --- 导入成功大横幅 --- */
.import-success-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(32px) saturate(1.5);
  -webkit-backdrop-filter: blur(32px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 24px;
  padding: 36px 48px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(255, 255, 255, 0.8);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.import-success-banner.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.import-success-banner.exit {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9);
}

.import-success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
  animation: successPop 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

@keyframes successPop {
  0% { transform: scale(0); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.import-success-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}

.import-success-text strong {
  color: var(--accent);
  font-weight: 700;
}

/* --- 侧边栏高亮提示 --- */
.sidebar-highlight {
  animation: sidebarFlash 1.5s ease;
}

@keyframes sidebarFlash {
  0%, 100% { border-color: var(--glass-border); box-shadow: var(--shadow-md); }
  25% { border-color: rgba(37, 99, 235, 0.4); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1), var(--shadow-md); }
  50% { border-color: rgba(37, 99, 235, 0.3); box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.08), var(--shadow-md); }
  75% { border-color: rgba(37, 99, 235, 0.2); box-shadow: var(--shadow-md); }
}

/* --- 不确定 checkbox 状态 --- */
.account-checkbox:indeterminate {
  background: var(--accent-lighter);
  border-color: var(--accent);
}

.account-checkbox:indeterminate::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 3px;
  width: 8px;
  height: 2px;
  background: white;
  border-radius: 1px;
}

/* --- Toast 点击关闭光标 --- */
.toast {
  cursor: pointer;
  user-select: none;
}

.toast:hover {
  filter: brightness(0.97);
}

/* --- 响应式 --- */
@media (max-width: 900px) {
  .main-layout { flex-direction: column; }
  .sidebar { width: 100%; min-width: unset; max-height: 300px; }
  .control-row { flex-wrap: wrap; }
  .input-narrow { width: 100%; min-width: unset; }
  .import-success-banner { padding: 24px 32px; }
}

@media (max-width: 600px) {
  .app-container { padding: 10px; }
  .app-header { padding: 12px 16px; }
  .control-actions { flex-direction: column; gap: 10px; }
  .action-buttons { width: 100%; }
  .action-buttons .btn { flex: 1; }
  .token-refresh-actions { align-items: stretch; flex-direction: column; }
  .token-refresh-file { min-width: 0; width: 100%; }
  .import-success-banner { padding: 20px 24px; min-width: 260px; }
}

[hidden] {
  display: none !important;
}

.visitor-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* --- 邮箱管理后台重构 --- */
:root {
  --console-bg: #fafafa;
  --console-panel: #ffffff;
  --console-sidebar: #f5f5f5;
  --console-sidebar-hover: #e8e8e8;
  --console-text: #1a1a1a;
  --console-muted: #6b7280;
  --console-line: #eaeaea;
  --console-primary: #1a1a1a;
  --console-primary-hover: #000000;
  --console-green: #15803d;
  --console-red: #b91c1c;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  color: var(--console-text);
  background: var(--console-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
.bg-animation { display: none; }

.management-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  width: 100%;
  min-height: 100vh;
}

.management-shell[hidden] { display: none; }

.management-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 0;
  color: var(--console-text);
  background: var(--console-sidebar);
  border-right: 1px solid var(--console-line);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 24px 20px 20px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 5px;
  color: #fff;
  background: #1a1a1a;
  font-size: 17px;
  font-weight: 700;
}

.brand-block h1 { margin: 0; color: var(--console-text); font-size: 15px; font-weight: 650; }
.brand-block p { margin: 3px 0 0; color: #8a8a8a; font-size: 10px; }

.primary-nav { display: grid; gap: 2px; padding: 6px 10px; }
.nav-item, .group-filter {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: #6b6b6b;
  background: transparent;
  text-align: left;
}
.nav-item:hover, .nav-item.active, .group-filter:hover, .group-filter.active { color: var(--console-text); background: var(--console-sidebar-hover); }
.nav-item.active { font-weight: 650; }
.nav-symbol { color: #8a8a8a; font-size: 15px; text-align: center; }
.nav-count { min-width: 24px; padding: 2px 6px; border-radius: 8px; color: #555; background: #dedede; font-size: 11px; text-align: center; }

.sidebar-section { min-height: 0; margin-top: 22px; padding: 0 10px; overflow-y: auto; }
.sidebar-section-title { padding: 0 10px 8px; color: #9a9a9a; font-size: 10px; font-weight: 600; text-transform: uppercase; }
.group-filter { grid-template-columns: minmax(0, 1fr) auto; min-height: 34px; font-size: 12px; }
.group-filter span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-retention { margin: auto 16px 16px; padding: 12px; border: 1px solid #eadfb8; border-radius: 6px; background: #fffdf5; }
.sidebar-retention strong { display: block; color: #9a6700; font-size: 13px; }
.sidebar-retention span { display: block; margin-top: 5px; color: #8a7a4b; font-size: 10px; line-height: 1.5; }

.management-main { min-width: 0; height: 100vh; overflow-y: auto; }
.workspace-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--console-line);
  background: rgba(255, 255, 255, .98);
}
.workspace-header h2 { margin: 0; font-size: 20px; font-weight: 700; }
.workspace-header p { margin: 4px 0 0; color: var(--console-muted); font-size: 12px; }
.workspace-heading { min-width: 0; flex: 1; }
.workspace-actions { display: flex; align-items: center; gap: 8px; }
.status-badge { display: inline-flex; align-items: center; gap: 7px; margin-right: 4px; color: var(--console-muted); font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }
.sidebar-toggle, .sidebar-scrim { display: none; }

.workspace-content { width: min(1440px, 100%); margin: 0 auto; padding: 26px 28px 40px; }
.view-panel { display: none; }
.view-panel.active { display: block; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.btn-primary { color: #fff; border-color: var(--console-primary); background: var(--console-primary); }
.btn-primary:hover { border-color: var(--console-primary-hover); background: var(--console-primary-hover); }
.btn-secondary { color: #374151; border-color: #d1d5db; background: #fff; }
.btn-secondary:hover { border-color: #9ca3af; background: #f9fafb; }
#btnOpenTokenRefresh { color: #2563eb; border-color: #bfdbfe; }
#btnOpenTokenRefresh:hover { border-color: #93c5fd; background: #eff6ff; }
.btn-danger { color: var(--console-red); border-color: #fecaca; background: #fff; }
.btn-danger:hover { background: #fef2f2; }
.text-button, .row-action { padding: 0; border: 0; color: var(--console-primary); background: none; font-weight: 600; }
.row-action { margin-left: 12px; font-size: 12px; }
.row-action.danger { color: var(--console-red); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { min-height: 118px; padding: 18px; border: 1px solid var(--console-line); border-radius: 7px; color: var(--console-text); background: var(--console-panel); text-decoration: none; }
.metric-card span { display: block; color: var(--console-muted); font-size: 12px; }
.metric-card strong { display: block; margin-top: 12px; font-size: 30px; line-height: 1; }
.metric-card small { display: block; margin-top: 12px; color: #9ca3af; font-size: 11px; }
.purchase-card { transition: border-color .15s ease, box-shadow .15s ease; }
.purchase-card:hover { border-color: #bdbdbd; box-shadow: 0 6px 20px rgba(0, 0, 0, .06); }
.purchase-card strong { font-size: 20px; line-height: 1.15; }
.purchase-card small b { color: #2563eb; font-size: 13px; }

.content-section { margin-top: 22px; border-top: 1px solid var(--console-line); padding-top: 22px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-heading h3 { margin: 0; font-size: 16px; }
.section-heading p { margin: 4px 0 0; color: var(--console-muted); font-size: 12px; }
.compact-account-list { border: 1px solid var(--console-line); border-radius: 7px; overflow: hidden; background: #fff; }
.compact-account {
  display: grid;
  grid-template-columns: 34px minmax(180px, 1fr) 170px 80px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 62px;
  padding: 10px 16px;
  border: 0;
  border-bottom: 1px solid var(--console-line);
  background: #fff;
  text-align: left;
}
.compact-account:last-child { border-bottom: 0; }
.compact-account:hover { background: #f8fafc; }
.account-avatar { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; border-radius: 6px; color: #1d4ed8; background: #dbeafe; font-size: 13px; font-weight: 700; }
.compact-account-main strong, .compact-account-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-account-main small { margin-top: 4px; color: var(--console-muted); font-size: 11px; }
.compact-account-time { color: var(--console-muted); font-size: 11px; }
.compact-account-action { color: var(--console-primary); font-size: 12px; font-weight: 600; text-align: right; }

.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.filter-row, .toolbar-actions { display: flex; align-items: center; gap: 8px; }
.search-control { display: flex; align-items: center; width: 260px; height: 36px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; }
.search-control span { padding-left: 11px; color: #9ca3af; font-size: 18px; }
.search-control input { width: 100%; height: 100%; padding: 0 10px; border: 0; outline: 0; background: transparent; }
.select-control { min-height: 36px; padding: 0 34px 0 11px; border: 1px solid #d1d5db; border-radius: 6px; color: #374151; background: #fff; outline: none; }
.select-control:focus, .search-control:focus-within, .textarea:focus { border-color: var(--console-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.select-control.full { width: 100%; }
.select-control.grow { flex: 1 1 260px; }

.selection-bar { margin-bottom: 10px; padding: 9px 12px; border: 1px solid #bfdbfe; border-radius: 6px; color: #1e40af; background: #eff6ff; font-size: 12px; }
.selection-bar .text-button { margin-left: 8px; }
.table-frame { overflow-x: auto; border: 1px solid var(--console-line); border-radius: 7px; background: #fff; }
.account-table { width: 100%; min-width: 980px; border-collapse: collapse; table-layout: fixed; }
.account-table th { height: 42px; padding: 0 12px; color: var(--console-muted); background: #f8fafc; font-size: 11px; font-weight: 600; text-align: left; }
.account-table td { height: 64px; padding: 8px 12px; border-top: 1px solid var(--console-line); vertical-align: middle; }
.account-table th:nth-child(2) { width: 20%; }
.account-table th:nth-child(3) { width: 14%; }
.account-table th:nth-child(4) { width: 10%; }
.account-table th:nth-child(5) { width: 13%; }
.account-table th:nth-child(6) { width: 9%; }
.account-table th:nth-child(7) { width: 14%; }
.check-cell { width: 44px; text-align: center !important; }
.actions-cell { width: 124px; text-align: right !important; }
.account-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.account-identity span:last-child { min-width: 0; }
.account-identity strong, .account-identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-identity strong { font-size: 12px; }
.account-identity small { margin-top: 4px; color: var(--console-muted); font-size: 10px; }
.credential-line { display: flex; align-items: center; gap: 7px; min-width: 0; }
.credential-line > span:first-child { min-width: 0; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.credential-copy { position: relative; width: 24px; height: 24px; flex: 0 0 24px; padding: 0; border: 0; border-radius: 4px; color: #9ca3af; background: transparent; }
.credential-copy span::before, .credential-copy span::after { position: absolute; width: 8px; height: 9px; border: 1px solid currentColor; border-radius: 1px; content: ""; }
.credential-copy span::before { top: 6px; left: 7px; }
.credential-copy span::after { top: 9px; left: 10px; background: #fff; }
.credential-copy:hover { color: #2563eb; background: #eff6ff; }
.credential-copy.copied { color: #15803d; background: #ecfdf5; }
.group-chip { display: inline-block; max-width: 100%; padding: 4px 8px; overflow: hidden; border-radius: 5px; color: #166534; background: #dcfce7; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.muted-cell, .date-cell { color: var(--console-muted); font-size: 11px; }
.protocol-badge { display: inline-block; margin-right: 4px; padding: 3px 6px; border-radius: 4px; font-size: 9px; font-weight: 700; }
.protocol-badge.imap { color: #1d4ed8; background: #dbeafe; }
.protocol-badge.graph { color: #047857; background: #d1fae5; }
.ready-status { color: var(--console-green); font-size: 11px; white-space: nowrap; }
.ready-status i { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: #22c55e; vertical-align: 1px; }
.table-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 180px; padding: 30px; color: var(--console-muted); text-align: center; }
.table-empty[hidden] { display: none; }
.table-empty strong { color: #374151; }
.table-empty span { margin-top: 6px; font-size: 12px; }
.pagination { display: flex; align-items: center; justify-content: space-between; min-height: 48px; color: var(--console-muted); font-size: 11px; }
.pagination div { display: flex; align-items: center; gap: 10px; }
.pagination button { min-height: 30px; padding: 0 10px; border: 1px solid #d1d5db; border-radius: 5px; background: #fff; }

.groups-heading { margin-bottom: 18px; }
.group-grid { display: grid; gap: 8px; }
.group-card { display: grid; grid-template-columns: 40px minmax(180px, 1fr) auto; align-items: center; gap: 10px; min-height: 68px; padding: 10px 16px; border: 1px solid var(--console-line); border-radius: 7px; background: #fff; }
.group-card-symbol { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 6px; color: #1d4ed8; background: #dbeafe; font-size: 18px; font-weight: 700; }
.group-card-main strong, .group-card-main span { display: block; }
.group-card-main span { margin-top: 4px; color: var(--console-muted); font-size: 11px; }
.group-card-actions { display: flex; align-items: center; gap: 14px; }
.group-card-actions .row-action { margin-left: 0; }

.mail-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.mail-target { min-width: 0; overflow: hidden; color: #374151; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.fetch-controls { display: flex; align-items: center; gap: 8px; padding: 14px; border: 1px solid var(--console-line); border-radius: 7px; background: #fff; }
.protocol-check { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; color: #374151; font-size: 12px; white-space: nowrap; }
.progress-bar-container { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--console-line); border-radius: 7px; background: #fff; }
.progress-bar-container[hidden] { display: none; }
.progress-info { display: flex; justify-content: space-between; gap: 16px; margin: 12px 0 7px; color: var(--console-muted); font-size: 11px; }
.progress-track { height: 7px; overflow: hidden; border-radius: 4px; background: #e5e7eb; }
.progress-fill { width: 0; height: 100%; background: var(--console-primary); transition: width .2s ease; }
.results-section { margin-top: 20px; }
.results-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.results-header[hidden], .fetch-issues[hidden] { display: none; }
.results-header h3 { margin: 0; font-size: 16px; }
.results-header p { margin: 4px 0 0; color: var(--console-muted); font-size: 11px; }
.fetch-issues { margin-bottom: 12px; padding: 10px 12px; border: 1px solid #fecaca; border-radius: 6px; color: #991b1b; background: #fef2f2; font-size: 11px; }
.email-list { display: grid; gap: 8px; }
.email-card { display: grid; gap: 6px; width: 100%; min-height: 116px; padding: 14px 16px; border: 1px solid var(--console-line); border-radius: 7px; color: var(--console-text); background: #fff; text-align: left; }
.email-card:hover { border-color: #93c5fd; }
.email-card-header { display: flex; justify-content: space-between; gap: 20px; }
.email-from { font-size: 12px; font-weight: 600; }
.email-date, .email-account-tag { color: var(--console-muted); font-size: 10px; }
.email-subject { font-size: 13px; }
.email-preview { overflow: hidden; color: var(--console-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.modal-overlay { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(15, 23, 42, .58); }
.modal-overlay.active { display: flex; }
.management-modal { width: min(620px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; border: 0; border-radius: 8px; background: #fff; box-shadow: 0 22px 60px rgba(15, 23, 42, .28); }
.management-modal.modal-small { width: min(430px, 100%); }
.management-modal.modal-large { width: min(900px, 100%); }
.management-modal .modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 18px 20px; border-bottom: 1px solid var(--console-line); }
.management-modal .modal-header h3 { margin: 0; font-size: 16px; }
.management-modal .modal-header p { margin: 4px 0 0; color: var(--console-muted); font-size: 11px; }
.btn-close { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 5px; color: #64748b; background: transparent; font-size: 22px; line-height: 1; }
.btn-close:hover { background: #f1f5f9; }
.modal-tabs { display: flex; gap: 20px; padding: 0 20px; border-bottom: 1px solid var(--console-line); }
.modal-tab { min-height: 42px; padding: 0; border: 0; border-bottom: 2px solid transparent; color: var(--console-muted); background: transparent; font-weight: 600; }
.modal-tab.active { color: var(--console-primary); border-bottom-color: var(--console-primary); }
.management-modal .modal-body { padding: 18px 20px; }
.management-modal .modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--console-line); }
.management-modal .modal-footer .status-text { margin-right: auto; color: var(--console-muted); font-size: 11px; }
.announcement-points { display: grid; gap: 12px; }
.announcement-points p { margin: 0; padding: 12px; border: 1px solid var(--console-line); border-radius: 6px; background: #fafafa; }
.announcement-points strong, .announcement-points span { display: block; }
.announcement-points strong { font-size: 12px; }
.announcement-points span { margin-top: 5px; color: var(--console-muted); font-size: 11px; line-height: 1.55; }
.import-pane { display: none; }
.import-pane.active { display: block; }
.textarea { width: 100%; min-height: 210px; padding: 12px; resize: vertical; border: 1px solid #d1d5db; border-radius: 6px; color: #1f2937; background: #fff; outline: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; line-height: 1.55; }
.field-help { margin: 8px 0 0; color: var(--console-muted); font-size: 10px; line-height: 1.6; }
.file-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 160px; border: 1px dashed #94a3b8; border-radius: 7px; background: #f8fafc; cursor: pointer; }
.file-drop strong { color: #334155; }
.file-drop span, .file-name { margin-top: 6px; color: var(--console-muted); font-size: 11px; }
.token-file-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 150px; border: 1px dashed #aeb4bc; border-radius: 7px; background: #fafafa; cursor: pointer; text-align: center; }
.token-file-drop:hover { border-color: #6b7280; background: #f7f7f7; }
.token-file-symbol { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 10px; border-radius: 6px; color: #2563eb; background: #eff6ff; font-size: 20px; }
.token-file-drop strong { color: #2f2f2f; font-size: 13px; }
.token-file-drop small { margin-top: 5px; color: #8a8a8a; font-size: 10px; }
.import-mode { display: flex; gap: 24px; margin: 16px 0 0; padding: 12px; border: 1px solid var(--console-line); border-radius: 6px; }
.import-mode legend { padding: 0 6px; color: var(--console-muted); font-size: 10px; }
.import-mode label { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.field-label { display: block; margin-bottom: 7px; color: #374151; font-size: 11px; font-weight: 600; }
.token-refresh-errors { margin-top: 8px; color: var(--console-red); font-size: 10px; }
.email-detail-body { color: #1f2937; line-height: 1.65; white-space: pre-wrap; }
.email-detail-body iframe { width: 100%; min-height: 460px; border: 0; background: #fff; }
.toast-container { position: fixed; top: auto; right: 16px; bottom: 16px; z-index: 200; display: flex; align-items: flex-end; gap: 8px; }
.toast { width: fit-content; max-width: min(300px, calc(100vw - 32px)); padding: 9px 12px; border: 1px solid var(--console-line); border-radius: 6px; color: #1f2937; background: #fff; box-shadow: 0 8px 24px rgba(15, 23, 42, .16); font-size: 12px; line-height: 1.4; }
.toast-success { border-left: 4px solid #22c55e; }
.toast-error { border-left: 4px solid #ef4444; }
.toast-warning { border-left: 4px solid #f59e0b; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .list-toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { width: 100%; overflow-x: auto; }
  .fetch-controls { align-items: stretch; flex-wrap: wrap; }
}

@media (max-width: 760px) {
  body { overflow: auto; }
  .management-shell { display: block; }
  .management-sidebar { position: static; width: 100%; height: auto; padding: 12px; }
  .brand-block { padding: 0 4px 12px; }
  .primary-nav { grid-template-columns: repeat(3, 1fr); }
  .nav-item { display: flex; justify-content: center; gap: 6px; padding: 0 6px; }
  .nav-symbol, .sidebar-section, .sidebar-retention { display: none; }
  .management-main { height: auto; overflow: visible; }
  .workspace-header { position: static; align-items: flex-start; min-height: 0; padding: 16px; }
  .workspace-header p, .status-badge, #btnOpenTokenRefresh { display: none; }
  .workspace-actions { flex-shrink: 0; }
  .workspace-content { padding: 16px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric-card { min-height: 104px; padding: 14px; }
  .metric-card strong { font-size: 25px; }
  .compact-account { grid-template-columns: 32px minmax(0, 1fr) auto; }
  .compact-account-time { display: none; }
  .list-toolbar, .filter-row { align-items: stretch; }
  .filter-row { width: 100%; flex-direction: column; }
  .search-control, .select-control { width: 100%; }
  .toolbar-actions { padding-bottom: 4px; }
  .group-card { grid-template-columns: 36px minmax(0, 1fr); }
  .group-card-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .fetch-controls { display: grid; grid-template-columns: 1fr 1fr; }
  .fetch-controls .grow { grid-column: 1 / -1; }
  .fetch-controls .btn-primary { grid-column: 1 / -1; }
  .management-modal { max-height: calc(100vh - 20px); }
}

.auth-modal {
  width: min(420px, calc(100vw - 32px));
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-footer {
  justify-content: space-between;
}

.modal-input {
  width: 100%;
  margin-bottom: 10px;
}

@media (max-width: 600px) {
  .visitor-identity {
    width: 100%;
    justify-content: space-between;
    order: 2;
  }
}

/* --- 目标站紧凑列表与邮件弹窗 --- */
.management-shell { grid-template-columns: 220px minmax(0, 1fr); }
.management-sidebar { display: flex; }
.management-main { width: 100%; }
.workspace-header {
  position: sticky;
  width: auto;
  min-height: 76px;
  margin: 0;
  padding: 16px 28px;
  border: 0;
  border-bottom: 1px solid var(--console-line);
  border-radius: 0;
  box-shadow: none;
}
.workspace-header h2 { font-size: 18px; }
.workspace-content { width: min(1320px, 100%); padding: 26px 28px 40px; }
.list-toolbar { padding: 14px; border: 1px solid var(--console-line); border-radius: 7px; background: #fff; }
.table-frame { box-shadow: 0 2px 8px rgba(0, 0, 0, .025); }

.mailbox-modal {
  display: flex;
  flex-direction: column;
  width: min(980px, calc(100vw - 32px));
  height: min(680px, calc(100vh - 32px));
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
}
.mailbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 66px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--console-line);
}
.mailbox-header h3 { margin: 0; font-size: 15px; }
.mailbox-header p { margin: 4px 0 0; color: var(--console-muted); font-size: 11px; }
.mailbox-header-actions { display: flex; align-items: center; gap: 8px; }
.mailbox-header-actions > span { color: var(--console-muted); font-size: 11px; }
.mailbox-tabs { display: flex; gap: 6px; min-height: 44px; padding: 8px 12px; border-bottom: 1px solid var(--console-line); }
.mailbox-tabs button { min-height: 28px; padding: 0 12px; border: 1px solid #dbe2ea; border-radius: 5px; color: #64748b; background: #fff; font-size: 11px; }
.mailbox-tabs button.active { color: #1d4ed8; border-color: #bfdbfe; background: #eff6ff; }
.mailbox-tabs span { display: inline-block; min-width: 14px; margin-left: 3px; text-align: center; }
.mailbox-query-controls { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(140px, 1fr) 86px auto; align-items: end; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--console-line); background: #fafafa; }
.mailbox-filter { display: grid; gap: 4px; min-width: 0; color: #707070; font-size: 10px; }
.mailbox-filter input, .mailbox-filter select { width: 100%; height: 32px; padding: 0 9px; border: 1px solid #d7d7d7; border-radius: 5px; color: #2f2f2f; background: #fff; outline: 0; }
.mailbox-filter input:focus, .mailbox-filter select:focus { border-color: #8f8f8f; box-shadow: 0 0 0 3px rgba(0, 0, 0, .05); }
.protocol-switches { display: flex; align-items: center; gap: 5px; min-height: 32px; }
.protocol-switches label { position: relative; cursor: pointer; }
.protocol-switches input { position: absolute; opacity: 0; pointer-events: none; }
.protocol-switches span { display: inline-flex; align-items: center; min-height: 32px; padding: 0 10px; border: 1px solid #d7d7d7; border-radius: 5px; color: #707070; background: #fff; font-size: 10px; font-weight: 650; }
.protocol-switches input:checked + span { color: #1d4ed8; border-color: #bfdbfe; background: #eff6ff; }
.mailbox-progress { padding: 0 12px 8px; border-bottom: 1px solid var(--console-line); }
.mailbox-progress[hidden] { display: none; }
.mailbox-progress .progress-info { margin-top: 7px; }
.mailbox-issues { max-height: 64px; margin: 8px 12px 0; overflow-y: auto; }
.mailbox-modal .results-header { display: none !important; }
.mailbox-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 0; flex: 1; margin: 0 12px 12px; border: 1px solid #dce2ea; border-radius: 6px; overflow: hidden; }
.mailbox-message-list { min-width: 0; overflow-y: auto; border-right: 1px solid #dce2ea; background: #f8fafc; }
.mailbox-message {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 78px;
  padding: 11px 12px;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid #e5e7eb;
  color: #1f2937;
  background: transparent;
  text-align: left;
}
.mailbox-message:hover, .mailbox-message.active { background: #eaf2ff; }
.mailbox-message strong, .mailbox-message span, .mailbox-message small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mailbox-message strong { font-size: 12px; }
.mailbox-message span { color: #475569; font-size: 11px; }
.mailbox-message small { color: #94a3b8; font-size: 10px; }
.mailbox-message-detail { min-width: 0; overflow: auto; background: #fff; }
.mailbox-detail-heading { padding: 15px 18px; border-bottom: 1px solid var(--console-line); }
.mailbox-detail-heading h4 { margin: 0; font-size: 15px; }
.mailbox-detail-heading p { margin: 6px 0 0; color: var(--console-muted); font-size: 10px; }
.mailbox-detail-content { min-height: 360px; padding: 18px; }
.mailbox-detail-content iframe { width: 100%; min-height: 430px; border: 0; background: #fff; }
.mailbox-plain-body { color: #334155; font-size: 12px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.mailbox-empty { display: grid; place-items: center; min-height: 100%; padding: 24px; color: #94a3b8; font-size: 12px; text-align: center; }

@media (max-width: 760px) {
  .workspace-header { width: calc(100% - 20px); margin: 10px auto; }
  .workspace-content { width: calc(100% - 20px); padding: 0 0 24px; }
  .workspace-header h2 { font-size: 16px; }
  .mailbox-modal { width: calc(100vw - 12px); height: calc(100vh - 12px); }
  .mailbox-header { align-items: flex-start; }
  .mailbox-header-actions > span { display: none; }
  .mailbox-layout { grid-template-columns: 1fr; grid-template-rows: 190px minmax(0, 1fr); }
  .mailbox-message-list { border-right: 0; border-bottom: 1px solid #dce2ea; }
  .mailbox-detail-content iframe { min-height: 300px; }
}

@media (max-width: 1024px) {
  body { overflow: auto; }
  .management-shell { display: block; }
  .management-sidebar { position: fixed; top: 0; left: 0; z-index: 80; width: 220px; height: 100vh; transform: translateX(-100%); transition: transform .2s ease; }
  .management-shell.sidebar-open .management-sidebar { transform: translateX(0); }
  .primary-nav { grid-template-columns: 1fr; }
  .nav-item { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; justify-content: initial; gap: 0; padding: 0 10px; }
  .nav-symbol, .sidebar-section, .sidebar-retention { display: block; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 70; display: block; visibility: hidden; background: rgba(0, 0, 0, .24); opacity: 0; transition: opacity .2s ease, visibility .2s ease; }
  .management-shell.sidebar-open .sidebar-scrim { visibility: visible; opacity: 1; }
  .sidebar-toggle { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; padding: 0; border: 1px solid #d7d7d7; border-radius: 5px; color: #333; background: #fff; font-size: 18px; }
  .management-main { height: auto; min-height: 100vh; overflow: visible; }
  .workspace-header { position: sticky; top: 0; width: auto; margin: 0; }
  .workspace-content { width: 100%; }
}

@media (max-width: 640px) {
  .workspace-header { flex-wrap: wrap; gap: 10px; min-height: 0; padding: 12px; }
  .workspace-header p, .status-badge { display: none; }
  .workspace-actions { width: 100%; justify-content: flex-end; }
  #btnOpenTokenRefresh { display: inline-flex; }
  .workspace-content { padding: 12px 10px 24px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card { min-height: 108px; padding: 14px; }
  .list-toolbar { padding: 10px; }
  .mailbox-query-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .mailbox-limit { grid-column: 1; }
  .protocol-switches { grid-column: 2; justify-content: flex-end; }
}
