/* ============================================================
   TempMail UI — 现代国风配色系统
   主色：砖红 / 墨绿 / 金黄 / 宣纸米白
   ============================================================ */

/* ---------- CSS 变量 ---------- */
:root {
  /* 品牌色 */
  --clr-primary:        #B85C38;   /* 砖红 / 赤陶 */
  --clr-primary-dark:   #8E3E22;
  --clr-primary-light:  #D4795A;
  --clr-accent:         #C8963E;   /* 琥珀金 */
  --clr-jade:           #3A7D44;   /* 翠绿 / 玉色 */
  --clr-jade-light:     #5AA35F;
  --clr-danger:         #C0392B;
  --clr-success:        #27AE60;
  --clr-warn:           #E67E22;

  /* 浅色模式 */
  --bg:                 #F5EDE0;   /* 宣纸米白 */
  --bg-card:            #FDFAF5;
  --bg-sidebar:         #2C1A0E;   /* 深墨棕 */
  --text:               #2C1810;
  --text-secondary:     #6B4226;
  --text-muted:         #9E7A5A;
  --border:             #D9C4A8;
  --border-light:       #EDE0CE;
  --shadow:             rgba(44, 24, 16, 0.12);

  /* 标题字体 */
  --font-sans: 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  --radius:   10px;
  --radius-sm: 6px;
  --transition: 0.22s ease;

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

/* 深色模式 */
[data-theme="dark"] {
  --bg:             #1A1208;   /* 墨黑 */
  --bg-card:        #241A0F;
  --bg-sidebar:     #120C04;
  --text:           #EDD9BE;
  --text-secondary: #C9A97A;
  --text-muted:     #8C7058;
  --border:         #3D2C1E;
  --border-light:   #2E2014;
  --shadow:         rgba(0, 0, 0, 0.4);
}

/* ---------- 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.6;
}
a { color: var(--clr-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
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: var(--border); border-radius: 3px; }

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

/* ===== AuthPage ===== */
#auth-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
#auth-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 80% 20%, rgba(184, 92, 56, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 20% 80%, rgba(58, 125, 68, 0.10) 0%, transparent 55%);
  pointer-events: none;
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2.2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 40px var(--shadow);
  position: relative;
  z-index: 1;
}
.auth-logo {
  text-align: center;
  margin-bottom: 1.8rem;
}
.auth-logo .logo-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 0.7rem;
  box-shadow: 0 4px 16px rgba(184,92,56,0.35);
}
.auth-logo h1 { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.auth-logo p { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.2rem; }

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.6rem;
}
.auth-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 0.7rem 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  font-weight: 500;
  transition: color var(--transition), border-color var(--transition);
}
.auth-tab.active {
  color: var(--clr-primary);
  border-bottom-color: var(--clr-primary);
}

/* ===== 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 rgba(255,255,255,0.07);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}
.user-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
  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: #FAEBD7;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-chip-role {
  font-size: 0.65rem;
  color: rgba(250,235,215,0.4);
}
.btn-logout {
  width: 100%;
  padding: 0.45rem;
  background: rgba(184,92,56,0.2);
  border: 1px solid rgba(184,92,56,0.35);
  border-radius: var(--radius-sm);
  color: rgba(250,235,215,0.7);
  font-size: 0.78rem;
  transition: all var(--transition);
}
.btn-logout:hover {
  background: rgba(184,92,56,0.35);
  color: #FAEBD7;
}
.btn-theme {
  width: 100%;
  padding: 0.45rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: rgba(250,235,215,0.55);
  font-size: 0.78rem;
  margin-top: 0.4rem;
  transition: all var(--transition);
}
.btn-theme:hover { background: rgba(255,255,255,0.12); color: #FAEBD7; }

/* ===== 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);
  border-radius: var(--radius);
  box-shadow: 0 2px 10px var(--shadow);
}
.card-header {
  padding: 1rem 1.3rem;
  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: 0.95rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.card-body { padding: 1.3rem; }

/* stat-cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.stat-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-note { font-size: 0.72rem; color: var(--text-muted); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--clr-primary);
  color: white;
}
.btn-primary:hover:not(:disabled) { background: var(--clr-primary-dark); }
.btn-success {
  background: var(--clr-jade);
  color: white;
}
.btn-success:hover:not(:disabled) { background: #2D6035; }
.btn-danger {
  background: var(--clr-danger);
  color: white;
}
.btn-danger:hover:not(:disabled) { background: #992B20; }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--border-light);
  color: var(--text);
}
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.78rem; }

/* 输入框 */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: 0.82rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.4rem; }
.form-input {
  display: block;
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.88rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(184,92,56,0.15);
}
.form-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.3rem; }

/* 表格 */
.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");
}
