/* ============================================================
   TempMail UI — Oat Gray Native (CLI PROXY API Style)
   柔和 / 米灰 / 原生面板 / 极简纯净
   ============================================================ */

/* ---------- CSS 变量 ---------- */
:root {
  /* 品牌色 - 深褐色（图中主按钮颜色）与翠绿（状态点缀） */
  --clr-primary: #8B8680;
  /* 图中登录按钮/菜单背景的深褐带灰 */
  --clr-primary-dark: #7A736C;
  --clr-primary-light: #AFAAa4;
  --clr-accent: #B4AFA7;
  --clr-jade: #24D07F;
  /* 图中“已连接”状态极亮的翠绿 */
  --clr-jade-light: #52DF9F;
  --clr-danger: #FF5B5B;
  --clr-success: #24D07F;
  --clr-warn: #FFB020;

  /* 浅色模式 - 完美的燕麦灰系统 */
  --bg: #FAF9F5;
  /* 全屏底色 */
  --bg-card: #F0EEE8;
  /* 卡片底色（图中的仪表盘数据卡片和登录卡片底色） */
  --bg-sidebar: #F0EEE8;
  /* 同样使用卡片底色作为侧边栏的温润感 */
  --text: #2C2C2C;
  /* 近黑色文字 */
  --text-secondary: #666666;
  --text-muted: #999999;
  --border: #E3E1DB;
  /* 极其微弱的高级灰色边框线 */
  --border-light: #ECEAE4;
  --shadow: rgba(0, 0, 0, 0.05);

  /* 标题字体：使用大字重非衬线体 */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Menlo', 'Cascadia Code', monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease-out;

  /* sidebar 宽度 */
  --sidebar-w: 240px;
}

/* 深色模式兼容 (被要求强制浅色，只留个底) */
[data-theme="dark"] {
  --bg: #000000;
  --bg-card: rgba(28, 28, 30, 1);
  --bg-sidebar: #121212;
  --text: #F5F5F7;
  --text-secondary: #86868B;
  --text-muted: #636366;
  --border: rgba(255, 255, 255, 0.1);
  --border-light: rgba(255, 255, 255, 0.05);
  --shadow: rgba(0, 0, 0, 0.3);
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

a:hover {
  text-decoration: none;
  color: var(--clr-primary);
}

button {
  cursor: pointer;
  font-family: inherit;
}

input,
textarea,
select {
  font-family: inherit;
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

/* ---------- 布局 ---------- */
#app {
  display: flex;
  min-height: 100vh;
}

/* ===== AuthPage ===== */
#auth-page {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.auth-hero {
  flex: 1;
  background: #000000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  padding: 4rem;
  overflow: hidden;
  position: relative;
}

.hero-text-wrapper {
  text-align: left;
  line-height: 0.85;
  position: relative;
  z-index: 2;
  margin-right: -2rem;
  /* 排版上略微侵入中间缝隙的感觉 */
}

.hero-line {
  font-size: clamp(6rem, 13vw, 12rem);
  font-weight: 900;
  color: #CCCCCC;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.auth-panel {
  flex: 1;
  background: #FAF9F5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
}

.auth-card {
  background: #F0EEE8;
  border: 0.8px solid #E3E1DB;
  border-radius: 12px;
  padding: 3.5rem 3rem;
  width: 100%;
  max-width: 440px;
  box-shadow: rgba(0, 0, 0, 0.1) 0px 10px 18px -3px;
  position: relative;
  z-index: 10;
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-icon-wrap {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #1FB6B1, #EBD551);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.logo-icon {
  font-size: 2.2rem;
  color: #111;
}

.auth-logo h1 {
  font-size: 1.45rem;
  font-weight: 800;
  color: #2F2D2C;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.auth-logo p {
  color: #7E7C78;
  font-size: 0.95rem;
}

.auth-tabs {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
  gap: 1.5rem;
}

.auth-tab {
  background: none;
  border: none;
  padding: 0.4rem 0.6rem;
  font-size: 0.88rem;
  color: #7E7C78;
  font-weight: 600;
  transition: color var(--transition);
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.auth-tab.active {
  color: #2F2D2C;
  border-bottom-color: #2F2D2C;
}

/* ===== Sidebar ===== */
#main-layout {
  display: flex;
  flex: 1;
}

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 1.4rem 1.2rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.sidebar-logo .logo-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.sidebar-logo span {
  font-size: 1.05rem;
  font-weight: 700;
  color: #FAEBD7;
  letter-spacing: 0.02em;
}

.sidebar-logo small {
  display: block;
  font-size: 0.65rem;
  color: rgba(250, 235, 215, 0.45);
  margin-top: -2px;
}

.sidebar-nav {
  flex: 1;
  padding: 0.8rem 0;
}

.nav-section {
  padding: 0.5rem 1rem 0.2rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: rgba(250, 235, 215, 0.35);
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 1.2rem;
  font-size: 0.875rem;
  color: rgba(250, 235, 215, 0.65);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  border-radius: 0;
  transition: color var(--transition), background var(--transition);
  position: relative;
}

.nav-item:hover {
  color: #FAEBD7;
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  color: #FAEBD7;
  background: rgba(184, 92, 56, 0.22);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--clr-primary);
  border-radius: 0 2px 2px 0;
}

.nav-item .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 0.95rem;
}

.sidebar-bottom {
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--border);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  background: rgba(0, 0, 0, 0.04);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

.user-avatar {
  width: 30px;
  height: 30px;
  background: var(--clr-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: white;
  flex-shrink: 0;
}

.user-chip-info {
  overflow: hidden;
}

.user-chip-name {
  font-size: 0.8rem;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip-role {
  font-size: 0.65rem;
  color: var(--text-secondary);
}

.btn-logout {
  width: 100%;
  padding: 0.45rem;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.78rem;
  transition: all var(--transition);
}

.btn-logout:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

.btn-theme {
  display: none;
  /* 强制浅色，不需要主题切换按钮 */
}

/* ===== Main Content ===== */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
}

.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 1.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.topbar-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.05rem;
}

.page {
  flex: 1;
  padding: 1.8rem;
  max-width: 1100px;
  width: 100%;
}

/* ===== 通用组件 ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px var(--shadow);
}

.card-header {
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-body {
  padding: 1.4rem;
}

/* stat-cards 仪表盘块 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.2rem;
  margin-bottom: 1.8rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid rgba(0, 0, 0, 0.03);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: 0 4px 20px var(--shadow);
  transition: transform var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  font-family: var(--font-sans);
}

.stat-note {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--clr-primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--clr-primary-dark);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-success {
  background: var(--clr-jade);
  color: #fff;
  box-shadow: 0 4px 12px rgba(36, 208, 127, 0.2);
}

.btn-success:active:not(:disabled) {
  background: var(--clr-jade-light);
  transform: scale(0.97);
}

.btn-danger {
  background: var(--clr-danger);
  color: #fff;
}

.btn-danger:active:not(:disabled) {
  background: #E04848;
  transform: scale(0.97);
}

.btn-ghost {
  background: #FFFFFF;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 2px 4px var(--shadow);
}

.btn-ghost:hover:not(:disabled) {
  background: #F9F9FB;
}

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
  border-radius: 8px;
}

/* 输入框 */
.form-group {
  margin-bottom: 1.4rem;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.form-input {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.95rem;
  transition: all var(--transition);
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.form-input:focus {
  border-color: var(--clr-primary-light);
  box-shadow: 0 0 0 4px rgba(148, 141, 133, 0.15);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* 表格 */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

th {
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(184, 92, 56, 0.04);
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-green {
  background: rgba(58, 125, 68, 0.15);
  color: var(--clr-jade);
}

.badge-red {
  background: rgba(192, 57, 43, 0.15);
  color: var(--clr-danger);
}

.badge-gold {
  background: rgba(200, 150, 62, 0.15);
  color: var(--clr-accent);
}

.badge-gray {
  background: rgba(0, 0, 0, 0.07);
  color: var(--text-muted);
}

[data-theme="dark"] .badge-gray {
  background: rgba(255, 255, 255, 0.08);
}

/* Code / API key */
.code-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--clr-primary);
  word-break: break-all;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
  transition: color var(--transition);
  flex-shrink: 0;
  font-size: 0.85rem;
}

.copy-btn:hover {
  color: var(--clr-primary);
}

/* 邮件列表项 */
.email-item {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 0.85rem 1.2rem;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition);
}

.email-item:last-child {
  border-bottom: none;
}

.email-item:hover {
  background: rgba(184, 92, 56, 0.05);
}

.email-item.unread {
  background: rgba(184, 92, 56, 0.04);
}

.email-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--clr-accent), var(--clr-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: white;
  flex-shrink: 0;
}

.email-meta {
  flex: 1;
  min-width: 0;
}

.email-from {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-subject {
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.1rem;
}

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

.email-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  margin-top: 0.1rem;
}

/* mailbox card */
.mailbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.mailbox-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}

.mailbox-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--clr-primary), var(--clr-accent));
  opacity: 0;
  transition: opacity var(--transition);
}

.mailbox-card:hover {
  border-color: var(--clr-primary);
  box-shadow: 0 4px 20px rgba(184, 92, 56, 0.15);
  transform: translateY(-2px);
}

.mailbox-card:hover::before {
  opacity: 1;
}

.mailbox-address {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--clr-primary);
  font-weight: 600;
  word-break: break-all;
}

.mailbox-stats {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.mailbox-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.8rem;
  flex-wrap: wrap;
}

/* domain guide */
.guide-step {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: flex-start;
}

.step-num {
  width: 32px;
  height: 32px;
  background: var(--clr-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.step-body {
  flex: 1;
}

.step-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.step-desc {
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.dns-table {
  width: 100%;
  font-size: 0.8rem;
  margin-top: 0.8rem;
}

.dns-table th {
  background: rgba(184, 92, 56, 0.08);
  color: var(--text-secondary);
}

.dns-table td {
  font-family: var(--font-mono);
}

/* 通知 Toast */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  min-width: 220px;
  max-width: 340px;
  padding: 0.7rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 20px var(--shadow);
  font-size: 0.84rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  pointer-events: auto;
  animation: slideIn 0.25s ease;
  border-left: 3px solid var(--clr-primary);
}

.toast.success {
  border-left-color: var(--clr-success);
}

.toast.error {
  border-left-color: var(--clr-danger);
}

.toast.warn {
  border-left-color: var(--clr-warn);
}

@keyframes slideIn {
  from {
    transform: translateX(30px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 12px 60px var(--shadow);
  position: relative;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  color: var(--text);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.3rem;
}

/* 分割线 */
.divider {
  height: 1px;
  background: var(--border);
  margin: 1.2rem 0;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.8rem;
  display: block;
}

.empty-state p {
  font-size: 0.88rem;
}

/* loading spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--clr-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

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

/* 邮件详情 */
.email-detail-header {
  padding: 1.3rem;
  border-bottom: 1px solid var(--border);
}

.email-subject-big {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.7rem;
}

.email-info-row {
  display: flex;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
  align-items: center;
}

.email-info-row strong {
  color: var(--text);
}

.email-body-frame {
  width: 100%;
  border: none;
  min-height: 400px;
  background: white;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.email-body-text {
  padding: 1.3rem;
  font-size: 0.88rem;
  white-space: pre-wrap;
  color: var(--text);
  line-height: 1.8;
  font-family: var(--font-mono);
}

/* toggle switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 0;
}

.toggle-label {
  font-size: 0.88rem;
  color: var(--text);
}

.toggle-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.15rem;
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 12px;
  transition: background var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
}

.toggle input:checked+.toggle-slider {
  background: var(--clr-jade);
}

.toggle input:checked+.toggle-slider::before {
  transform: translateX(20px);
}

/* API key display */
.apikey-hero {
  text-align: center;
  padding: 2rem 1rem;
}

.apikey-hero .big-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

.apikey-hero h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.apikey-hero p {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* ===== 汉堡按钮 ===== */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
  padding: 0.3rem 0.45rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  flex-shrink: 0;
}

.hamburger-btn:hover {
  background: var(--border-light);
}

/* ===== 侧边栏遮罩（移动端） ===== */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 199;
  backdrop-filter: blur(1px);
}

.sidebar-backdrop.show {
  display: block;
}

/* ===== 响应式：平板（icon-only 侧边栏） ===== */
@media (max-width: 768px) and (min-width: 601px) {
  .sidebar {
    width: 60px;
    overflow: hidden;
  }

  .sidebar .nav-item span,
  .sidebar-logo span,
  .sidebar-logo small,
  .user-chip-info,
  .nav-section {
    display: none;
  }

  .sidebar-logo {
    justify-content: center;
    padding: 1rem 0.5rem;
  }

  .nav-item {
    justify-content: center;
    padding: 0.7rem;
  }

  .sidebar-bottom {
    padding: 0.5rem;
  }

  .user-chip {
    justify-content: center;
  }

  .btn-logout,
  .btn-theme {
    font-size: 0;
    padding: 0.45rem 0;
  }

  .page {
    padding: 1rem;
  }
}

/* ===== 响应式：手机（抽屉式侧边栏） ===== */
@media (max-width: 600px) {
  .hamburger-btn {
    display: inline-flex;
    align-items: center;
  }

  /* 侧边栏变为左侧抽屉 */
  .sidebar {
    position: fixed !important;
    left: -240px !important;
    width: 220px !important;
    z-index: 200;
    height: 100vh;
    transition: left 0.25s ease;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .sidebar.mob-open {
    left: 0 !important;
    box-shadow: 6px 0 30px rgba(0, 0, 0, 0.5);
  }

  /* 抽屉展开时恢复完整文字 */
  .sidebar .nav-item span,
  .sidebar-logo span,
  .sidebar-logo small,
  .user-chip-info,
  .nav-section {
    display: block !important;
  }

  .sidebar-logo {
    justify-content: flex-start !important;
    padding: 1.4rem 1.2rem 1rem !important;
  }

  .nav-item {
    justify-content: flex-start !important;
    padding: 0.55rem 1.2rem !important;
    gap: 0.65rem !important;
  }

  .sidebar-bottom {
    padding: 0.8rem 1rem !important;
  }

  .user-chip {
    justify-content: flex-start !important;
  }

  .btn-logout,
  .btn-theme {
    font-size: 0.78rem !important;
    padding: 0.45rem !important;
  }

  /* 内容区全宽 */
  .content {
    width: 100vw;
    min-width: 0;
  }

  /* Topbar */
  .topbar {
    padding: 0.6rem 0.85rem;
    gap: 0.4rem;
    flex-wrap: nowrap;
  }

  .topbar>div:first-child {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    flex: 1;
  }

  .topbar-title {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-subtitle {
    font-size: 0.72rem;
  }

  #topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    justify-content: flex-end;
    flex-shrink: 0;
  }

  #topbar-actions .btn {
    font-size: 0.73rem;
    padding: 0.3rem 0.55rem;
  }

  /* 页面内边距 */
  .page {
    padding: 0.85rem;
  }

  /* 卡片 */
  .card-header {
    padding: 0.75rem 1rem;
  }

  .card-body {
    padding: 1rem;
  }

  /* 表格 */
  th,
  td {
    padding: 0.5rem 0.65rem;
    font-size: 0.79rem;
  }

  /* 统计卡 */
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
    margin-bottom: 1rem;
  }

  .stat-value {
    font-size: 1.45rem;
  }

  /* 邮箱卡片 */
  .mailbox-grid {
    grid-template-columns: 1fr;
  }

  /* 域名指南双列 → 单列 */
  .domain-guide-grid {
    grid-template-columns: 1fr !important;
  }

  /* Modal → 底部弹出 */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 88vh;
    overflow-y: auto;
    padding: 1.4rem 1.2rem 2rem;
    max-width: 100%;
  }

  /* Toast */
  #toast-container {
    bottom: 0.8rem;
    right: 0.8rem;
    left: 0.8rem;
  }

  .toast {
    max-width: 100%;
    min-width: 0;
  }

  /* code-box */
  .code-box {
    font-size: 0.72rem;
  }

  /* 邮件阅读 iframe */
  .email-frame {
    min-height: 200px;
  }

  /* guide step */
  .guide-step {
    gap: 0.6rem;
  }

  .step-num {
    width: 26px;
    height: 26px;
    font-size: 0.78rem;
  }
}

/* 装饰纹路 (国风) */
.grain-bg {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect width='1' height='1' fill='%23000' opacity='.03'/%3E%3C/svg%3E");
}