/* 本地临时邮箱工作台样式：无外部字体、无外部图标依赖 */
:root {
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 248px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body[data-theme="dark"] {
  --bg: #0b1020;
  --bg-soft: #10172b;
  --surface: rgba(22, 31, 52, .86);
  --surface-2: rgba(30, 41, 66, .72);
  --surface-3: rgba(39, 52, 80, .6);
  --line: rgba(139, 160, 200, .16);
  --line-strong: rgba(139, 160, 200, .3);
  --text: #eaf0ff;
  --text-2: #aebbd6;
  --text-3: #7585a4;
  --accent: #6d8bff;
  --accent-2: #26d3b0;
  --accent-soft: rgba(109, 139, 255, .14);
  --amber: #ffb35c;
  --danger: #ff6b7d;
  --shadow: 0 18px 50px rgba(0, 0, 0, .32);
  --grad: linear-gradient(135deg, #6d8bff 0%, #8d6dff 48%, #26d3b0 100%);
}

body[data-theme="light"] {
  --bg: #f3f6fc;
  --bg-soft: #e9eef8;
  --surface: rgba(255, 255, 255, .92);
  --surface-2: rgba(246, 249, 255, .9);
  --surface-3: rgba(232, 239, 252, .8);
  --line: rgba(70, 92, 140, .13);
  --line-strong: rgba(70, 92, 140, .24);
  --text: #1b2540;
  --text-2: #51607d;
  --text-3: #8894ac;
  --accent: #4c67e8;
  --accent-2: #0aa888;
  --accent-soft: rgba(76, 103, 232, .1);
  --amber: #d98218;
  --danger: #e04a60;
  --shadow: 0 16px 42px rgba(35, 55, 100, .13);
  --grad: linear-gradient(135deg, #5270f0 0%, #8a63e8 48%, #12b591 100%);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(680px 420px at 12% -8%, rgba(109, 139, 255, .18), transparent 70%),
    radial-gradient(620px 420px at 96% 6%, rgba(38, 211, 176, .11), transparent 72%);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
a { color: var(--accent); }

.app { position: relative; z-index: 1; display: flex; min-height: 100vh; }

/* 侧栏 */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  padding: 24px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  background: var(--grad); color: #fff; box-shadow: 0 8px 20px rgba(109, 139, 255, .3);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 17px; letter-spacing: .5px; }
.brand-text span { font-size: 9px; color: var(--text-3); letter-spacing: 1.3px; margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; border: 0; border-radius: 12px;
  background: transparent; color: var(--text-2); font-size: 14px; font-weight: 600;
  transition: background .18s, color .18s, transform .18s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); transform: translateX(2px); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item em { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 20px; background: var(--surface-3); color: var(--text-2); }
.nav-item.active em { background: var(--accent); color: #fff; }

.side-card {
  margin-top: auto; padding: 16px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface-2);
}
.side-card-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); box-shadow: 0 0 0 4px var(--surface-3); }
.dot.on { background: var(--accent-2); box-shadow: 0 0 0 4px rgba(38,211,176,.14); }
.dot.auto { background: var(--amber); box-shadow: 0 0 0 4px rgba(255,179,92,.14); animation: blink 1.4s infinite; }
.dot.err { background: var(--danger); box-shadow: 0 0 0 4px rgba(255,107,125,.14); }
.side-card p { color: var(--text-3); font-size: 12px; line-height: 1.6; margin: 10px 0 14px; }
.side-card-foot { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.side-card-foot svg { width: 13px; height: 13px; }
.sidebar-foot { text-align: center; color: var(--text-3); font-size: 11px; }
.sidebar-mask { display: none; }

/* 主区域 */
.main { flex: 1; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 16px 30px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { min-width: 0; }
.topbar-title h1 { margin: 0; font-size: 20px; letter-spacing: .3px; }
.topbar-title p { margin: 3px 0 0; color: var(--text-3); font-size: 12px; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; flex: none;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface); color: var(--text-2); transition: .18s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.icon-btn.primary { background: var(--grad); border-color: transparent; color: #fff; }
.icon-btn.spin svg { animation: spin .8s linear infinite; }
.menu-btn { display: none; }
.content { padding: 24px 30px 60px; max-width: 1320px; margin: 0 auto; }
.view { display: none; animation: fadeUp .32s ease; }
.view.active { display: block; }

/* 通用控件 */
.primary-btn, .ghost-btn, .chip-btn, .danger-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 11px; font-size: 13px; font-weight: 700; transition: .18s;
  border: 1px solid transparent; white-space: nowrap;
}
.primary-btn { padding: 11px 18px; background: var(--grad); color: #fff; box-shadow: 0 8px 22px rgba(109,139,255,.25); }
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(109,139,255,.36); }
.primary-btn.wide { width: 100%; margin-top: 14px; }
.primary-btn.danger-btn { background: linear-gradient(135deg, #ff6b7d, #e04560); }
.ghost-btn { padding: 10px 14px; background: var(--surface-2); border-color: var(--line); color: var(--text-2); }
.ghost-btn:hover { color: var(--accent); border-color: var(--accent); }
.ghost-btn.danger, .chip-btn.danger { color: var(--danger); }
.ghost-btn.danger:hover { border-color: var(--danger); background: rgba(255,107,125,.08); }
.chip-btn { padding: 7px 11px; background: var(--surface-3); border-color: var(--line); color: var(--text-2); font-size: 12px; }
.chip-btn:hover { color: var(--accent); border-color: var(--accent); }
.danger-ghost { width: 38px; height: 38px; padding: 0; background: transparent; color: var(--text-3); border-color: var(--line); }
.danger-ghost:hover { color: var(--danger); border-color: var(--danger); background: rgba(255,107,125,.08); }
select, .text-input {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; outline: none; font-size: 13px;
}
select:focus, .text-input:focus, .search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* 模式提示条 */
.mode-banner {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 18px;
  border-radius: 14px; border: 1px solid var(--line);
  background: linear-gradient(100deg, var(--accent-soft), var(--surface-2));
}
.mode-banner.auto { border-color: rgba(255,179,92,.38); background: linear-gradient(100deg, rgba(255,179,92,.14), var(--surface-2)); }
.mode-banner.saved { border-color: rgba(38,211,176,.32); background: linear-gradient(100deg, rgba(38,211,176,.12), var(--surface-2)); }
.mode-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--accent); flex: none; }
.mode-banner.auto .mode-icon { color: var(--amber); }
.mode-banner.saved .mode-icon { color: var(--accent-2); }
.mode-copy { min-width: 0; }
.mode-copy strong { font-size: 13px; }
.mode-copy p { margin: 3px 0 0; font-size: 12px; color: var(--text-3); line-height: 1.5; }
.mode-banner .ghost-btn { margin-left: auto; }

/* 地址卡片 */
.address-card {
  position: relative; overflow: hidden;
  padding: 22px 24px; border-radius: 20px;
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(520px 220px at 100% 0%, rgba(109,139,255,.14), transparent 70%),
    var(--surface);
  box-shadow: var(--shadow);
}
.address-card::after {
  content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 100%; background: var(--grad); opacity: .85;
}
.address-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.address-label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); letter-spacing: .5px; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 5px rgba(38,211,176,.12); animation: blink 2s infinite; }
.address-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.address-row { display: flex; align-items: center; gap: 12px; margin: 16px 0 18px; flex-wrap: wrap; }
.address-value {
  flex: 1; min-width: 220px; font-size: clamp(19px, 3vw, 28px); font-weight: 800;
  letter-spacing: .4px; word-break: break-all;
  background: var(--surface-3); border: 1px dashed var(--line-strong);
  border-radius: 12px; padding: 12px 16px; color: var(--text);
}
.address-value.placeholder { color: var(--text-3); font-weight: 600; font-size: 18px; }
.address-meta { display: flex; gap: 22px; flex-wrap: wrap; font-size: 11px; color: var(--text-3); }
.address-meta span { display: flex; align-items: center; gap: 6px; }
.address-meta svg { width: 13px; height: 13px; }
.address-meta b { color: var(--text-2); font-weight: 600; }

/* 统计 */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0; }
.stat { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.stat-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.stat-icon.blue { background: rgba(109,139,255,.14); color: var(--accent); }
.stat-icon.amber { background: rgba(255,179,92,.14); color: var(--amber); }
.stat-icon.violet { background: rgba(160,110,255,.14); color: #b18cff; }
.stat-icon.green { background: rgba(38,211,176,.14); color: var(--accent-2); }
.stat small { display: block; color: var(--text-3); font-size: 11px; margin-bottom: 3px; }
.stat strong { font-size: 20px; line-height: 1; }

/* 面板 */
.panel { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); overflow: hidden; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-title { display: flex; align-items: center; gap: 9px; }
.panel-title > svg { color: var(--accent); }
.panel-title h2 { margin: 0; font-size: 15px; }
.count { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); }
.panel-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel-note { margin: 0; padding: 14px 18px 0; color: var(--text-3); font-size: 12px; line-height: 1.6; }
.search { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 10px; padding: 0 11px; background: var(--surface-2); color: var(--text-3); }
.search svg { width: 15px; height: 15px; }
.search input { width: 190px; border: 0; background: transparent; color: var(--text); padding: 9px 0; outline: none; font-size: 12px; }
.filters { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.filter { padding: 6px 13px; border-radius: 20px; border: 1px solid var(--line); background: transparent; color: var(--text-3); font-size: 12px; font-weight: 600; }
.filter:hover { color: var(--text); }
.filter.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.filter-tip { margin-left: auto; display: flex; align-items: center; gap: 5px; color: var(--text-3); font-size: 11px; }
.filter-tip svg { width: 13px; height: 13px; }

/* 邮件列表 */
.mail-list { max-height: 640px; overflow-y: auto; }
.mail-list::-webkit-scrollbar, .timeline::-webkit-scrollbar, .sidebar::-webkit-scrollbar { width: 7px; }
.mail-list::-webkit-scrollbar-thumb, .timeline::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; }
.mail-item { border-bottom: 1px solid var(--line); transition: background .18s; }
.mail-item:last-child { border-bottom: 0; }
.mail-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 18px; cursor: pointer; }
.mail-head:hover { background: var(--surface-2); }
.mail-avatar { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; font-size: 13px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #6d8bff, #a06dff); }
.mail-item.read .mail-avatar { background: var(--surface-3); color: var(--text-3); }
.mail-main { min-width: 0; flex: 1; }
.mail-line { display: flex; align-items: center; gap: 8px; }
.mail-from { font-size: 13px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item.unread .mail-from::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; margin-right: 2px; }
.mail-time { margin-left: auto; font-size: 11px; color: var(--text-3); white-space: nowrap; }
.mail-subject { margin-top: 4px; font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-excerpt { margin-top: 4px; font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-badges { display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap; }
.badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px; background: var(--surface-3); color: var(--text-3); }
.badge.code { background: rgba(160,110,255,.14); color: #b18cff; }
.badge.unread { background: rgba(109,139,255,.16); color: var(--accent); }
.mail-tools { display: flex; gap: 6px; align-items: center; }
.mini-btn { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--text-3); }
.mini-btn svg { width: 14px; height: 14px; }
.mini-btn:hover { color: var(--accent); border-color: var(--accent); }
.mini-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
.mail-body { margin: 0 18px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); overflow: hidden; animation: fadeUp .2s ease; }
.mail-body-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mail-body-head .mail-label { font-size: 11px; color: var(--text-3); }
.code-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 14px 0; }
.code-chip { border: 1px dashed rgba(160,110,255,.5); background: rgba(160,110,255,.1); color: #b18cff; padding: 6px 10px; border-radius: 9px; font-size: 13px; font-weight: 800; letter-spacing: 1px; }
.code-chip:hover { background: rgba(160,110,255,.22); }
.mail-content { padding: 14px; font-size: 13px; line-height: 1.75; color: var(--text-2); word-break: break-word; max-height: 420px; overflow: auto; }
.mail-content a { color: var(--accent); }
.mail-content img { max-width: 100%; }
.mail-content pre { white-space: pre-wrap; }
.empty { padding: 60px 20px; text-align: center; color: var(--text-3); }
.empty.hidden { display: none; }
.empty-illustration { width: 66px; height: 66px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 20px; background: var(--surface-3); color: var(--text-3); }
.empty-illustration svg { width: 30px; height: 30px; }
.empty strong { display: block; color: var(--text-2); font-size: 14px; }
.empty p { font-size: 12px; margin: 8px 0 0; }

/* 日志 */
.timeline { padding: 8px 18px 20px; max-height: 620px; overflow-y: auto; }
.log-row { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.log-row:last-child { border-bottom: 0; }
.log-mark { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.log-row.mail .log-mark { background: var(--accent-2); box-shadow: 0 0 0 4px rgba(38,211,176,.12); }
.log-row.warn .log-mark { background: var(--amber); box-shadow: 0 0 0 4px rgba(255,179,92,.12); }
.log-row.err .log-mark { background: var(--danger); box-shadow: 0 0 0 4px rgba(255,107,125,.12); }
.log-copy { min-width: 0; }
.log-copy strong { font-size: 12px; font-weight: 700; }
.log-copy p { margin: 4px 0 0; font-size: 12px; color: var(--text-2); line-height: 1.55; word-break: break-word; }
.log-time { margin-left: auto; font-size: 11px; color: var(--text-3); white-space: nowrap; padding-top: 2px; }

/* 设置 */
.settings-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; }
.settings-panel-stack { display: flex; flex-direction: column; gap: 18px; }
.settings-panel .panel-head { border-bottom: 0; }
.setting-row { display: flex; align-items: center; gap: 18px; padding: 14px 18px; border-top: 1px solid var(--line); }
.setting-row > div { flex: 1; min-width: 0; }
.setting-row strong { font-size: 13px; }
.setting-row p { margin: 5px 0 0; font-size: 11px; color: var(--text-3); line-height: 1.6; }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: var(--surface-3); border: 1px solid var(--line-strong); transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: var(--text-3); top: 3px; left: 3px; transition: .2s; }
.switch input:checked + span { background: var(--grad); border-color: transparent; }
.switch input:checked + span::after { transform: translateX(18px); background: #fff; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 14px 18px 18px; }
.btn-grid .ghost-btn, .file-label { width: 100%; cursor: pointer; }
.file-label { margin: 0; }
.usage { display: flex; justify-content: space-between; padding: 0 18px 18px; font-size: 12px; color: var(--text-3); }
.usage b { color: var(--text); }
.danger-zone { border-color: rgba(255,107,125,.25); }

/* 弹窗 / 提示 */
.modal { position: fixed; inset: 0; z-index: 80; display: none; place-items: center; padding: 20px; background: rgba(5, 9, 20, .68); backdrop-filter: blur(6px); }
.modal.show { display: grid; animation: fade .18s ease; }
.modal-card { position: relative; width: min(420px, 100%); padding: 28px; border-radius: 20px; border: 1px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow); animation: fadeUp .22s ease; }
.modal-card h3 { margin: 0 0 6px; font-size: 17px; }
.modal-sub { margin: 0; color: var(--text-3); font-size: 12px; line-height: 1.6; }
.modal-close { position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--text-3); display: grid; place-items: center; }
.modal-close:hover { color: var(--danger); }
.qr-box { margin: 20px auto 12px; width: 224px; height: 224px; padding: 12px; border-radius: 16px; background: #fff; display: grid; place-items: center; }
.qr-email { text-align: center; font-size: 13px; font-weight: 700; word-break: break-all; color: var(--text-2); }
.confirm-actions { display: flex; gap: 10px; margin-top: 22px; }
.confirm-actions > * { flex: 1; }
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: flex; flex-direction: column; gap: 9px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 9px; padding: 12px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow); font-size: 12px; font-weight: 600; animation: slideIn .25s ease; max-width: min(360px, 90vw); }
.toast svg { width: 16px; height: 16px; color: var(--accent-2); }
.toast.warn svg { color: var(--amber); }
.toast.err svg { color: var(--danger); }
.toast.out { animation: slideOut .25s ease forwards; }

/* 滚动与显示优化 */
html { scroll-behavior: smooth; }
body { overscroll-behavior-y: contain; }
::selection { background: rgba(109, 139, 255, .35); color: var(--text); }
.mail-list, .timeline, .sidebar, .mail-content, .translate-result {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.mail-head { touch-action: pan-y; }
.mail-subject, .mail-excerpt { min-height: 1.25em; }
.mail-content { overflow-wrap: anywhere; line-height: 1.85; }
.mail-content img, .mail-content table { max-width: 100%; height: auto; }
.mail-content blockquote { margin-left: 0; padding-left: 12px; border-left: 3px solid var(--accent); color: var(--text-3); }
.mail-content h1, .mail-content h2, .mail-content h3 { line-height: 1.4; }

/* 译文面板 */
.translate-box { margin: 12px 14px 0; border: 1px solid rgba(109,139,255,.3); border-radius: 13px; background: var(--accent-soft); overflow: hidden; }
.translate-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.translate-head > svg { color: var(--accent); width: 15px; height: 15px; }
.translate-head strong { font-size: 12px; }
.translate-head .chip-btn { margin-left: auto; }
.translate-text { padding: 12px; font-size: 13px; line-height: 1.85; color: var(--text); word-break: break-word; max-height: 340px; overflow: auto; }
.translate-text a { color: var(--accent); }
.translate-actions { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.original-hidden { display: none; }
.wide-card { width: min(560px, 100%); }
.translate-result { margin-top: 14px; max-height: 320px; overflow: auto; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }

/* 选中文字工具栏 */
.selection-bar { position: fixed; z-index: 90; display: none; align-items: center; gap: 3px; padding: 5px; border-radius: 11px; border: 1px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow); }
.selection-bar.show { display: flex; animation: fadeUp .15s ease; }
.selection-bar button { display: flex; align-items: center; gap: 5px; padding: 6px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font-size: 11px; font-weight: 700; }
.selection-bar button:hover { background: var(--accent-soft); color: var(--accent); }
.selection-bar svg { width: 13px; height: 13px; }
.to-top { position: fixed; right: 22px; bottom: 84px; z-index: 40; width: 40px; height: 40px; display: none; place-items: center; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); box-shadow: var(--shadow); }
.to-top.show { display: grid; }
.to-top:hover { color: var(--accent); border-color: var(--accent); }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes slideOut { to { opacity: 0; transform: translateX(18px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: .4; } }

@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .sidebar-mask.show { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.5); }
  .menu-btn { display: grid; }
  .topbar { padding: 14px 18px; }
  .content { padding: 18px 16px 50px; }
  .panel-tools { width: 100%; }
  .search { flex: 1; }
  .search input { width: 100%; }
  .mail-time { font-size: 10px; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat { padding: 12px; }
  .stat strong { font-size: 17px; }
  .address-card { padding: 18px; }
  .address-row .primary-btn { width: 100%; }
  .address-meta { gap: 10px; }
  .mail-head { padding: 12px; gap: 9px; }
  .mail-body { margin: 0 12px 14px; }
  .btn-grid { grid-template-columns: 1fr; }
  .topbar-title p { display: none; }
  .toasts { right: 12px; bottom: 12px; left: 12px; align-items: stretch; }
  .to-top { right: 12px; bottom: 74px; }
  .search input, select, .text-input { font-size: 16px; }
  .mail-content, .translate-text { font-size: 14px; }
  .selection-bar button { padding: 8px 10px; }
}
