/* ============================================================
   TempMail UI — chromatic black / chromatic white
   Palette: spectral white / spectral black / muted graphite
   ============================================================ */

/* ---------- CSS 变量 ---------- */
:root {
  /* 品牌色 */
  --clr-primary:        #222B28;
  --clr-primary-dark:   #111716;
  --clr-primary-light:  #5C6964;
  --clr-accent:         #68727A;
  --clr-jade:           #465B55;
  --clr-jade-light:     #81908B;
  --clr-danger:         #7C4850;
  --clr-success:        #4D6F61;
  --clr-warn:           #76684B;

  /* 浅色模式 */
  --bg:                 #F7F8F7;
  --bg-card:            #FFFFFF;
  --bg-soft:            #EEF0EF;
  --bg-sidebar:         #FFFFFF;
  --sidebar-text:       #171A19;
  --sidebar-muted:      #7B8580;
  --sidebar-soft:       rgba(17, 24, 39, 0.055);
  --sidebar-active:     rgba(34, 43, 40, 0.10);
  --sidebar-border:     rgba(15, 17, 18, 0.08);
  --text:               #151817;
  --text-secondary:     #555D5A;
  --text-muted:         #858D89;
  --border:             #DDE2DF;
  --border-light:       #ECEFEE;
  --shadow:             rgba(15, 17, 18, 0.10);

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

  --radius:   18px;
  --radius-sm: 10px;
  --transition: 0.18s ease;

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

/* 深色模式 */
[data-theme="dark"] {
  --bg:             #050606;
  --bg-card:        #0C0E0F;
  --bg-soft:        #111416;
  --bg-sidebar:     #030404;
  --sidebar-text:   #E8ECE8;
  --sidebar-muted:  rgba(232,236,232,0.52);
  --sidebar-soft:   rgba(232,236,232,0.08);
  --sidebar-active: rgba(232,236,232,0.12);
  --sidebar-border: rgba(232,236,232,0.08);
  --text:           #F3F6F5;
  --text-secondary: #B2BAB7;
  --text-muted:     #6F7774;
  --border:         #22282A;
  --border-light:   #171C1E;
  --shadow:         rgba(0, 0, 0, 0.52);
}

/* ---------- 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:
    radial-gradient(circle at 10% -8%, rgba(98, 119, 255, 0.055), transparent 30rem),
    radial-gradient(circle at 92% 12%, rgba(255, 101, 165, 0.045), transparent 28rem),
    radial-gradient(circle at 46% 105%, rgba(67, 210, 180, 0.055), transparent 32rem),
    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; }

.ui-icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.16em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  overflow: visible;
  pointer-events: none;
}

.btn .ui-icon,
.btn-theme .ui-icon,
.btn-logout .ui-icon,
.nav-icon .ui-icon {
  width: 1rem;
  height: 1rem;
}

.logo-icon .ui-icon,
.logo-mark .ui-icon {
  width: 1.35rem;
  height: 1.35rem;
  color: white;
  stroke-width: 2.2;
}

.card-title .ui-icon,
.modal-title .ui-icon,
.badge .ui-icon,
.toast .ui-icon,
.mailbox-stats .ui-icon {
  width: 1rem;
  height: 1rem;
}

.badge .ui-icon {
  width: 0.72rem;
  height: 0.72rem;
  stroke-width: 2.4;
}

/* 滚动条美化 */
::-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:
    radial-gradient(circle at 14% 12%, rgba(98,119,255,0.10), transparent 20rem),
    radial-gradient(circle at 84% 70%, rgba(67,210,180,0.10), transparent 22rem),
    radial-gradient(circle at 78% 18%, rgba(255,101,165,0.07), transparent 18rem),
    var(--bg);
  position: relative;
  overflow: hidden;
}
#auth-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(36,35,31,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36,35,31,0.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, black, transparent 72%);
  pointer-events: none;
}
.auth-card {
  background: rgba(250, 251, 248, 0.88);
  border: 1px solid rgba(213, 220, 214, 0.92);
  border-radius: 28px;
  padding: 2.4rem 2.25rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 28px 90px rgba(16,20,18,0.14), inset 0 1px 0 rgba(255,255,255,0.78);
  backdrop-filter: blur(18px);
  position: relative;
  z-index: 1;
}
.auth-theme-actions {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.35rem;
}
.auth-theme-btn {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.72);
  color: #242A28;
  border-radius: 999px;
  padding: 0.34rem 0.62rem;
  font-size: 0.72rem;
  font-weight: 650;
  cursor: pointer;
  transition: all var(--transition);
}
.auth-theme-btn:hover {
  background: white;
  border-color: #BFC7C2;
}
.auth-form-area {
  text-align: center;
}
.auth-form-area .form-label,
.auth-form-area .form-hint,
.auth-form-area .divider {
  text-align: center;
}
.auth-form-area .form-input {
  text-align: center;
}
[data-theme="dark"] #auth-page {
  background:
    radial-gradient(circle at 12% 10%, rgba(98,119,255,0.11), transparent 20rem),
    radial-gradient(circle at 86% 74%, rgba(67,210,180,0.08), transparent 22rem),
    #050606;
}
[data-theme="dark"] #auth-page::before {
  background-image:
    linear-gradient(rgba(232,236,232,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232,236,232,0.035) 1px, transparent 1px);
  opacity: 0.38;
}
[data-theme="dark"] .auth-card {
  background: rgba(12, 14, 15, 0.94);
  border-color: #273033;
  box-shadow: 0 28px 90px rgba(0,0,0,0.62), inset 0 1px 0 rgba(255,255,255,0.035);
}
[data-theme="dark"] .auth-theme-btn {
  background: #070909;
  border-color: #273033;
  color: #DCE3DF;
}
[data-theme="dark"] .auth-theme-btn:hover {
  background: #151A1B;
  border-color: #3A4649;
  color: #F3F6F5;
}
[data-theme="dark"] .auth-logo h1 {
  color: #F3F6F5;
}
[data-theme="dark"] .auth-logo p {
  color: #8B9691;
}
[data-theme="dark"] .auth-tabs {
  background: #080A0B;
  border-color: #22292B;
}
[data-theme="dark"] .auth-tab {
  color: #7D8783;
}
[data-theme="dark"] .auth-tab.active {
  background: #151A1B;
  color: #F3F6F5;
  box-shadow: 0 8px 18px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.04);
}
[data-theme="dark"] .auth-card .form-label {
  color: #DCE3DF;
}
[data-theme="dark"] .auth-card .form-hint {
  color: #7D8783;
}
[data-theme="dark"] .auth-card .divider {
  color: #6F7774;
}
[data-theme="dark"] .auth-card .form-input {
  background: #070909;
  color: #F3F6F5;
  border-color: #273033;
}
[data-theme="dark"] .auth-card .form-input::placeholder {
  color: #626C68;
}
[data-theme="dark"] .auth-card .form-input:focus {
  border-color: #53606A;
  box-shadow: 0 0 0 4px rgba(98,119,255,0.16);
}
.auth-logo {
  text-align: center;
  margin-bottom: 1.8rem;
}
.auth-logo .logo-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, #111716, #5C6964);
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 0.7rem;
  box-shadow: 0 14px 34px rgba(49,92,77,0.24);
}
img.logo-icon {
  object-fit: cover;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.35rem;
}
.auth-logo h1 { font-size: 1.5rem; font-weight: 750; color: #111716; }
.auth-logo p { font-size: 0.82rem; color: #5B6661; margin-top: 0.2rem; }

.auth-tabs {
  display: flex;
  background: var(--bg-soft);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 0.25rem;
  margin-bottom: 1.6rem;
}
.auth-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 0.62rem 0.7rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  border-radius: 999px;
  font-weight: 500;
  transition: color var(--transition), border-color var(--transition);
}
.auth-tab.active {
  color: var(--text);
  background: var(--bg-card);
  box-shadow: 0 4px 14px rgba(36,35,31,0.08);
}

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

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(98,119,255,0.045), transparent 14rem),
    radial-gradient(circle at 100% 35%, rgba(67,210,180,0.038), transparent 14rem),
    var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--sidebar-border);
  box-shadow: 12px 0 40px rgba(15,17,18,0.045);
}
[data-theme="dark"] .sidebar { box-shadow: none; }
.sidebar-logo {
  padding: 1.35rem 1.15rem 1.05rem;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.sidebar-logo .logo-mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #111716, #5C6964);
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  color: white;
  box-shadow: 0 10px 22px rgba(17,23,22,0.18);
}
img.logo-mark {
  object-fit: cover;
  background: var(--bg-card);
  border: 1px solid var(--sidebar-border);
  padding: 0.22rem;
}
[data-theme="dark"] img.logo-mark { background: #0E1111; }
.sidebar-logo span {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--sidebar-text);
  letter-spacing: 0.02em;
}
.sidebar-logo small {
  display: block;
  font-size: 0.65rem;
  color: var(--sidebar-muted);
  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: var(--sidebar-muted);
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.58rem 1.05rem;
  margin: 0.08rem 0.7rem;
  font-size: 0.875rem;
  color: var(--sidebar-muted);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  border-radius: 12px;
  transition: color var(--transition), background var(--transition);
  position: relative;
}
.nav-item:hover {
  color: var(--sidebar-text);
  background: var(--sidebar-soft);
}
.nav-item.active {
  color: var(--sidebar-text);
  background: var(--sidebar-active);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0.25rem; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--clr-primary-light);
  border-radius: 999px;
}
.nav-item .nav-icon { width: 18px; text-align: center; font-size: 0.95rem; }

.sidebar-bottom {
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--sidebar-border);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  background: var(--sidebar-soft);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}
.user-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, #111716, #5C6964);
  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(--sidebar-text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-chip-role {
  font-size: 0.65rem;
  color: var(--sidebar-muted);
}
.btn-logout {
  width: 100%;
  padding: 0.5rem;
  background: rgba(147,78,78,0.10);
  border: 1px solid rgba(147,78,78,0.28);
  border-radius: var(--radius-sm);
  color: #7A3030;
  font-size: 0.78rem;
  font-weight: 650;
  transition: all var(--transition);
}
.btn-logout:hover {
  background: rgba(147,78,78,0.16);
  color: #5E2424;
}
[data-theme="dark"] .btn-logout {
  background: rgba(147,78,78,0.16);
  border-color: rgba(147,78,78,0.30);
  color: #D8B0B0;
}
[data-theme="dark"] .btn-logout:hover {
  background: rgba(147,78,78,0.24);
  color: #F0D0D0;
}
.btn-theme {
  width: 100%;
  padding: 0.45rem;
  background: var(--sidebar-soft);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-sm);
  color: var(--sidebar-muted);
  font-size: 0.78rem;
  margin-top: 0.4rem;
  transition: all var(--transition);
}
.btn-theme:hover { background: var(--sidebar-active); color: var(--sidebar-text); }

/* ===== Main Content ===== */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
}
.topbar {
  background: rgba(255,255,255,0.78);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 1.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}
[data-theme="dark"] .topbar { background: rgba(8,10,11,0.78); }
.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: 1160px;
  width: 100%;
}

/* ===== 通用组件 ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 14px 38px rgba(15,17,18,0.065), inset 0 1px 0 rgba(255,255,255,0.72);
  overflow: hidden;
}
[data-theme="dark"] .card {
  box-shadow: 0 18px 46px rgba(0,0,0,0.34), inset 0 1px 0 rgba(255,255,255,0.035);
}
.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;
  box-shadow: 0 12px 28px rgba(15,17,18,0.055), inset 0 1px 0 rgba(255,255,255,0.65);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(98,119,255,0.045), transparent 28%, rgba(67,210,180,0.04));
  opacity: 0.65;
  pointer-events: none;
}
[data-theme="dark"] .stat-card {
  background: #0D1011;
  border-color: #202629;
  box-shadow: 0 16px 38px rgba(0,0,0,0.36), inset 0 1px 0 rgba(255,255,255,0.028);
}
[data-theme="dark"] .stat-card::after {
  background:
    linear-gradient(90deg, rgba(98,119,255,0.032), transparent 34%, rgba(67,210,180,0.028));
  opacity: 0.75;
}
.stat-card > * {
  position: relative;
  z-index: 1;
}
.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;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.56rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 650;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
  line-height: 1.2;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #242A28, #111716);
  color: white;
  box-shadow: 0 8px 18px rgba(17,23,22,0.18);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(17,23,22,0.24); }
.btn-success {
  background: linear-gradient(180deg, #4D6F61, #314B41);
  color: white;
}
.btn-success:hover:not(:disabled) { background: #2D6035; }
.btn-danger {
  background: #1B1F20;
  color: #F2F4F3;
  border: 1px solid #2E3638;
}
.btn-danger:hover:not(:disabled) {
  background: #2A171A;
  border-color: #7C4850;
  color: #FFFFFF;
}
[data-theme="dark"] .btn-danger {
  background: #121617;
  border-color: #30383A;
  color: #D8DFDB;
}
[data-theme="dark"] .btn-danger:hover:not(:disabled) {
  background: #261417;
  border-color: #7C4850;
  color: #F3F6F5;
}
.btn-ghost {
  background: rgba(255,255,255,0.38);
  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.68rem 0.9rem;
  background: rgba(255,255,255,0.56);
  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 4px rgba(79,111,82,0.14);
}
[data-theme="dark"] .form-input { background: rgba(255,255,255,0.035); }
.form-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.3rem; }
.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.28rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.segmented-control label {
  min-width: 0;
}
.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.segmented-control span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.15rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}
.segmented-control input:checked + span {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 4px 16px rgba(15, 17, 18, 0.08);
}
.input-affix {
  display: flex;
  align-items: stretch;
  width: 100%;
}
.input-affix .form-input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.input-affix span {
  display: inline-flex;
  align-items: center;
  max-width: 45%;
  padding: 0 0.8rem;
  border: 1px solid var(--border);
  border-left: 0;
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.select-wrap {
  position: relative;
}
.select-wrap::after {
  content: '';
  position: absolute;
  right: 0.95rem;
  top: 50%;
  width: 0.48rem;
  height: 0.48rem;
  border-right: 1.8px solid #53605B;
  border-bottom: 1.8px solid #53605B;
  transform: translateY(-62%) rotate(45deg);
  pointer-events: none;
}
.form-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #F4F6F5;
  background-image: none;
  color: #1F2623;
  border-color: #D9DEDB;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.78);
  padding-right: 2.4rem;
}
.form-select option {
  background: #FFFFFF;
  color: #1F2623;
}
.form-select:focus {
  border-color: #9AA5A0;
  box-shadow: 0 0 0 4px rgba(83,96,106,0.12), inset 0 1px 0 rgba(255,255,255,0.78);
}
[data-theme="dark"] .form-select {
  background-color: #070909;
  background-image: none;
  color: #DCE3DF;
  border-color: #22292B;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
}
[data-theme="dark"] .select-wrap::after {
  border-color: #AEB8B4;
}
[data-theme="dark"] .form-select option {
  background: #0C0E0F;
  color: #E8ECE8;
}
[data-theme="dark"] .form-select:focus {
  border-color: #3A4649;
  box-shadow: 0 0 0 4px rgba(98,119,255,0.14), inset 0 1px 0 rgba(255,255,255,0.035);
}

/* 表格 */
.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-soft);
  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(79,111,82,0.055); }

/* 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(95,141,115,0.16); color: var(--clr-jade); }
.badge-red   { background: rgba(124,72,80,0.13); color: var(--clr-danger); }
.badge-gold  { background: rgba(83,96,106,0.14); 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: color-mix(in srgb, var(--bg-soft) 68%, white);
  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;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  min-height: 1.55rem;
}
.copy-btn:hover { color: var(--clr-primary); }
.copy-btn .ui-icon { width: 1rem; height: 1rem; }

/* 邮件列表项 */
.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(79,111,82,0.055); }
.email-item.unread { background: rgba(79,111,82,0.045); }
.email-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #53606A, #222B28);
  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.18rem 1.25rem;
  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, rgba(98,119,255,0.45), rgba(67,210,180,0.45));
  opacity: 0;
  transition: opacity var(--transition);
}
.mailbox-card:hover {
  border-color: var(--clr-primary);
  box-shadow: 0 16px 34px rgba(79,111,82,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: linear-gradient(180deg, #242A28, #111716);
  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(79,111,82,0.10); 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(6px);
}
.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 28px 90px rgba(0,0,0,0.24);
  position: relative;
}
.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.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;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
}
.modal-close .ui-icon { width: 1.05rem; height: 1.05rem; }
.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 .empty-icon .ui-icon { width: 2.5rem; height: 2.5rem; }
.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 .big-icon .ui-icon { width: 3rem; height: 3rem; }
.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; }

/* API docs */
.api-docs-page {
  max-width: 900px;
}
.api-key-panel {
  margin-bottom: 1.2rem;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.82rem;
  box-shadow: 0 10px 28px rgba(15,17,18,0.045);
}
.api-key-label {
  color: var(--text-muted);
  font-weight: 650;
}
.api-key-value {
  color: var(--text);
  font-family: var(--font-mono);
  filter: blur(3px);
  cursor: pointer;
  word-break: break-all;
}
.api-doc-card .card-title {
  letter-spacing: -0.01em;
}
.api-doc-desc {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  line-height: 1.75;
}
.api-code-block {
  position: relative;
  white-space: pre;
  overflow-x: auto;
  padding: 1rem 1.1rem;
  padding-right: 2.8rem;
  border-radius: 14px;
  border: 1px solid #D9DEDB;
  background: #F4F6F5;
  color: #1F2623;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.65;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.78);
}
.api-code-copy {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--border);
}
[data-theme="dark"] .api-key-panel {
  background: #0F1213;
  border-color: #252C2F;
  box-shadow: 0 18px 44px rgba(0,0,0,0.30);
}
[data-theme="dark"] .api-key-label {
  color: #7D8783;
}
[data-theme="dark"] .api-key-value {
  color: #E4E9E6;
}
[data-theme="dark"] .api-doc-desc {
  color: #A8B1AD;
}
[data-theme="dark"] .api-code-block {
  background: #070909;
  border-color: #22292B;
  color: #DCE3DF;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035), 0 12px 32px rgba(0,0,0,0.18);
}
[data-theme="dark"] .api-code-block::selection {
  background: rgba(98,119,255,0.28);
}
[data-theme="dark"] .api-code-copy {
  background: #111617;
  border-color: #2B3436;
  color: #B8C1BD;
}
[data-theme="dark"] .api-code-copy:hover {
  color: #F3F6F5;
  background: #171D1F;
}

/* Admin account list */
.account-key-box {
  margin-top: 0.38rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  max-width: 390px;
  padding: 0.58rem 0.62rem 0.58rem 0.72rem;
  border-radius: 12px;
  border: 1px solid #D9DEDB;
  background: #F4F6F5;
  color: #1F2623;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.35;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.78);
}
.account-key-box span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-key-box .copy-btn {
  width: 1.7rem;
  height: 1.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #53605B;
}
.account-key-box .copy-btn:hover {
  color: #151817;
  background: white;
}
[data-theme="dark"] .account-key-box {
  background: #070909;
  border-color: #22292B;
  color: #DCE3DF;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035), 0 10px 24px rgba(0,0,0,0.14);
}
[data-theme="dark"] .account-key-box .copy-btn {
  background: #121718;
  border-color: #2B3436;
  color: #AEB8B4;
}
[data-theme="dark"] .account-key-box .copy-btn:hover {
  color: #F3F6F5;
  background: #171D1F;
}

/* ===== 汉堡按钮 ===== */
.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; }
  .nav-item .nav-icon { display: inline-flex !important; }
  .nav-item .nav-icon .ui-icon { display: inline-flex !important; }
  .sidebar-bottom { padding: 0.5rem; }
  .user-chip { justify-content: center; }
  .btn-logout, .btn-theme { font-size: 0; padding: 0.45rem 0; }
  .btn-logout .ui-icon, .btn-theme .ui-icon { width: 1rem; height: 1rem; }
  .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; }
}

.github-float {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 120;
  color: #F7F8F7;
  background: #111716;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 16px 42px rgba(15,17,18,0.24), inset 0 1px 0 rgba(255,255,255,0.08);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}
.github-float svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: currentColor;
}
.github-float:hover {
  transform: translateY(-2px);
  background: #242A28;
  box-shadow: 0 20px 52px rgba(15,17,18,0.32), inset 0 1px 0 rgba(255,255,255,0.10);
}
[data-theme="dark"] .github-float {
  color: #050606;
  background: #F3F6F5;
  border-color: rgba(255,255,255,0.18);
  box-shadow: 0 18px 50px rgba(0,0,0,0.46), inset 0 1px 0 rgba(255,255,255,0.75);
}
[data-theme="dark"] .github-float:hover {
  background: #DCE3DF;
}
@media (max-width: 600px) {
  .github-float {
    right: 0.85rem;
    bottom: 0.85rem;
    width: 2.65rem;
    height: 2.65rem;
  }
}

/* 装饰纹路 (国风) */
.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");
}

/* Final auth contrast overrides: keep after all generic theme rules. */
.auth-card .auth-logo h1 {
  color: #111716;
}
.auth-card .auth-logo p {
  color: #5B6661;
}
[data-theme="dark"] .auth-card .auth-logo h1 {
  color: #F3F6F5;
}
[data-theme="dark"] .auth-card .auth-logo p {
  color: #8B9691;
}
