/* ============ 数据中心 · 多开邮箱系统 v3 浅色商务风 ============ */
:root {
  --bg: #f4f6fa;
  --panel-bg: #ffffff;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --accent: #4f46e5;
  --green: #16a34a;
  --green-soft: #f0fdf4;
  --text-1: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow: 0 6px 24px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.1);
  --danger: #dc2626;
}
html.dark {
  --bg: #0b1220;
  --panel-bg: #0f1a2e;
  --card-bg: #0f1a2e;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.16);
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-soft: rgba(59, 130, 246, 0.14);
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.12);
  --text-1: #f1f5f9;
  --text-2: #c3cddb;
  --text-3: #7b8aa0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text-1);
  overflow-x: hidden;
  transition: background 0.25s, color 0.25s;
}

.page-container { min-height: 100vh; display: flex; flex-direction: column; }

/* ============ 导航 ============ */
.nav {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background 0.25s;
}
html.dark .nav { background: rgba(11, 18, 32, 0.9); }
.nav-inner { max-width: 1080px; margin: 0 auto; padding: 11px 20px; display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.logo-icon { width: 38px; height: 38px; }
.logo-text { line-height: 1.15; }
.logo-title { font-size: 18px; font-weight: 800; color: var(--text-1); letter-spacing: 0.5px; }
.logo-sub { font-size: 10px; color: var(--text-3); letter-spacing: 2px; }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-link {
  color: var(--text-2); text-decoration: none; font-size: 13.5px; font-weight: 500;
  padding: 6px 12px; border-radius: 8px; transition: all 0.2s;
}
.nav-link:hover, .nav-link.active { color: var(--primary); background: var(--primary-soft); }
.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 9px; cursor: pointer;
  background: var(--card-bg); color: var(--text-2); transition: all 0.2s;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }

/* ============ 主区域 ============ */
.main { flex: 1; max-width: 1080px; width: 100%; margin: 0 auto; padding: 22px 20px 44px; }

/* ============ 顶部操作面板 ============ */
.mailbox-panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 22px;
}
/* 顶部蓝色装饰条 */
.mailbox-panel::before {
  content: ''; display: block; height: 4px;
  background: linear-gradient(90deg, #2563eb, #4f46e5, #7c3aed);
}
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 22px 26px 0;
}
.panel-title {
  font-size: 22px; font-weight: 800; line-height: 1.4; color: var(--text-1);
  letter-spacing: 0.3px;
}
.text-accent {
  background: linear-gradient(92deg, #2563eb, #7c3aed);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.panel-desc { font-size: 13.5px; color: var(--text-2); margin-top: 7px; line-height: 1.7; }
.status-badge {
  display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0;
  background: var(--green-soft); color: var(--green);
  font-size: 12px; font-weight: 600; padding: 5px 13px; border-radius: 999px;
  margin-top: 4px;
}
.status-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* 操作行 */
.panel-toolbar {
  display: flex; align-items: stretch; gap: 12px;
  padding: 20px 26px;
}
.mailbox-input-wrap {
  flex: 1; display: flex; align-items: center;
  background: var(--bg); border: 1.5px solid var(--border-strong);
  border-radius: 12px; padding: 0 12px; min-height: 52px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.mailbox-input-wrap:focus-within {
  border-color: var(--primary);
  background: var(--card-bg);
  box-shadow: 0 0 0 3.5px rgba(37, 99, 235, 0.12);
}
.mail-icon { width: 18px; height: 18px; color: var(--text-3); flex-shrink: 0; }
#mailboxId {
  flex: 1; min-width: 0; background: transparent; border: none; outline: none;
  color: var(--text-1); font-size: 15px; font-weight: 700; font-family: inherit;
  padding: 0 10px; height: 100%;
}
#mailboxId::placeholder { color: var(--text-3); font-weight: 400; }
.domain-select { position: relative; display: flex; align-items: center; }
.select-chevron { position: absolute; right: 9px; width: 13px; height: 13px; color: var(--text-3); pointer-events: none; }
#domainSelect {
  appearance: none; -webkit-appearance: none;
  background: var(--card-bg); color: var(--text-1);
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 12.5px; font-weight: 600; font-family: inherit;
  padding: 8px 26px 8px 11px; cursor: pointer; outline: none;
  max-width: 150px;
}
.copy-btn {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border: none; border-radius: 10px; cursor: pointer;
  background: var(--primary-soft); color: var(--primary); transition: all 0.2s; flex-shrink: 0;
}
.copy-btn:hover { background: rgba(37, 99, 235, 0.2); }
.copy-btn.copied { background: var(--green-soft); color: var(--green); }

.btn-group { display: flex; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 12px; padding: 0 22px; min-height: 52px;
  font-size: 14px; font-weight: 700; font-family: inherit; cursor: pointer;
  transition: all 0.2s; white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, #2563eb, #4f46e5); color: #fff; box-shadow: 0 6px 18px rgba(37, 99, 235, 0.3); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(37, 99, 235, 0.4); }
.btn-ghost { background: var(--primary-soft); color: var(--primary); }
.btn-ghost:hover { background: rgba(37, 99, 235, 0.18); }
.btn-danger { background: rgba(220, 38, 38, 0.08); color: var(--danger); }
.btn-danger:hover { background: rgba(220, 38, 38, 0.14); }

/* 面板底部：倒计时 + 功能亮点 */
.panel-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 13px 26px 16px;
  border-top: 1px solid var(--border);
  background: rgba(244, 246, 250, 0.5);
}
html.dark .panel-foot { background: rgba(255, 255, 255, 0.03); }
.ttl-mini { font-size: 12px; color: var(--text-3); }
.ttl-mini b { color: var(--primary); font-variant-numeric: tabular-nums; font-weight: 700; }
.panel-features { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.pf-item { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); }
.pf-item svg { color: var(--primary); opacity: 0.8; }

/* ============ 收件箱卡片 ============ */
.inbox-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.inbox-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.inbox-title { font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 9px; }
.inbox-title::before {
  content: ''; width: 4px; height: 18px; border-radius: 99px;
  background: linear-gradient(180deg, #2563eb, #7c3aed);
}
.inbox-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.live-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--green);
  background: var(--green-soft); padding: 5px 12px; border-radius: 999px;
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulse 1.6s infinite; }

.table-wrap { padding: 0 12px 12px; }
.mail-table { width: 100%; border-collapse: collapse; }
.mail-table thead th {
  text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: 0.5px; color: var(--text-3);
  padding: 10px 14px; background: var(--bg);
}
.mail-table thead th:first-child { border-radius: 8px 0 0 8px; }
.mail-table thead th:last-child { border-radius: 0 8px 8px 0; text-align: right; }
.mail-table tbody tr { border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.mail-table tbody tr:last-child { border-bottom: none; }
.mail-table tbody tr:hover { background: var(--primary-soft); }
.mail-table tbody td { padding: 12px 14px; font-size: 13.5px; }
.mail-sender { display: flex; align-items: center; gap: 10px; max-width: 280px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #fff;
}
.sender-name { font-weight: 600; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sender-addr { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-subject { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.mail-subject.unread { color: var(--text-1); font-weight: 700; }
.mail-subject.unread::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); margin-right: 7px; vertical-align: 1px; }
.mail-time { font-size: 12px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mail-actions { display: flex; justify-content: flex-end; gap: 6px; }
.row-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: none; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--text-3); transition: all 0.15s;
}
.row-btn:hover { background: rgba(220, 38, 38, 0.1); color: var(--danger); }

/* 移动端邮件卡片 */
.mail-cards { display: flex; flex-direction: column; gap: 9px; padding: 0 12px 12px; }
.mail-card {
  display: flex; flex-direction: column; gap: 7px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; cursor: pointer; transition: all 0.15s;
}
.mail-card:active { transform: scale(0.99); }
.mail-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mail-card .sender-name { font-size: 13px; }
.mail-card-subject { font-size: 13px; color: var(--text-1); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 空状态 */
.empty-tip { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 42px 20px 50px; text-align: center; }
.empty-icon { position: relative; width: 60px; height: 60px; color: var(--primary); opacity: 0.35; margin-bottom: 14px; }
.empty-icon svg { width: 100%; height: 100%; }
.empty-dot { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 12px; height: 12px; border-radius: 50%; background: var(--primary); opacity: 0.75; }
.empty-title { font-size: 16px; font-weight: 700; margin-bottom: 5px; }
.empty-desc { font-size: 13px; color: var(--text-3); }

/* ============ 页脚 ============ */
.footer { text-align: center; padding: 20px; font-size: 12px; color: var(--text-3); border-top: 1px solid var(--border); background: var(--card-bg); }

/* ============ 弹窗 ============ */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(4px);
  padding: 18px;
}
.modal.hidden { display: none; }
.modal-card {
  width: 100%; max-width: 620px; max-height: 88vh;
  display: flex; flex-direction: column;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-lg);
  animation: pop 0.2s ease;
}
@keyframes pop { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-sm { max-width: 420px; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 17px 20px; border-bottom: 1px solid var(--border); }
.modal-subject { font-size: 16px; font-weight: 800; margin-bottom: 5px; word-break: break-all; }
.modal-from { font-size: 13px; color: var(--text-2); word-break: break-all; }
.modal-date { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.modal-title { font-size: 16px; font-weight: 800; }
.modal-close { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: none; border-radius: 8px; background: transparent; color: var(--text-3); cursor: pointer; transition: all 0.15s; flex-shrink: 0; }
.modal-close:hover { background: rgba(220, 38, 38, 0.1); color: var(--danger); }
.modal-body { padding: 17px 20px 20px; overflow-y: auto; flex: 1; }
.modal-content { font-size: 13.5px; line-height: 1.75; color: var(--text-1); word-break: break-word; }
.prose img { max-width: 100%; border-radius: 8px; }
.prose a { color: var(--primary); }
.prose table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.prose table td, .prose table th { border: 1px solid var(--border); padding: 6px 9px; font-size: 12.5px; }
.raw-area { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.raw-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  font-size: 12px; color: var(--text-3); font-family: inherit; transition: color 0.15s;
}
.raw-toggle:hover { color: var(--primary); }
.raw-content {
  margin-top: 10px; padding: 12px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text-2);
  font-size: 11.5px; font-family: ui-monospace, "SF Mono", Consolas, monospace;
  max-height: 34vh; overflow: auto; white-space: pre-wrap; word-break: break-all;
}

/* 表单 */
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.custom-input-wrap { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--border-strong); border-radius: 11px; padding: 0 13px; min-height: 46px; }
.custom-input-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
#customInput { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: var(--text-1); font-size: 14px; font-weight: 600; font-family: inherit; }
.custom-domain { font-size: 13px; font-weight: 600; color: var(--text-3); white-space: nowrap; }
.field-error { font-size: 12px; color: var(--danger); margin-top: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal-actions .btn { min-height: 42px; padding: 0 20px; border-radius: 10px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: #0f172a; color: #fff; font-size: 13px;
  padding: 10px 20px; border-radius: 10px; z-index: 99;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s ease;
}
.toast.hidden { display: none; }
@keyframes toastIn { from { transform: translateX(-50%) translateY(12px); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }

/* ============ 响应式 ============ */
.mobile-only { display: none; }
@media (max-width: 767px) {
  .desktop-only { display: none; }
  .mobile-only { display: block; }
  .nav-inner { padding: 9px 14px; }
  .logo-icon { width: 32px; height: 32px; }
  .logo-title { font-size: 16px; }
  .logo-sub { font-size: 9px; }
  .main { padding: 14px 10px 30px; }
  .mailbox-panel { border-radius: 14px; margin-bottom: 14px; }
  .panel-head { padding: 16px 16px 0; flex-direction: column; gap: 10px; }
  .panel-title { font-size: 17px; }
  .panel-desc { font-size: 12.5px; margin-top: 5px; }
  .panel-toolbar { flex-direction: column; gap: 9px; padding: 14px 16px; }
  .mailbox-input-wrap { min-height: 46px; border-radius: 10px; padding: 0 10px; }
  #mailboxId { font-size: 13.5px; padding: 0 8px; }
  #domainSelect { max-width: 104px; font-size: 11.5px; padding: 7px 22px 7px 10px; }
  .copy-btn { width: 34px; height: 34px; }
  .btn-group .btn { flex: 1; min-height: 44px; font-size: 13px; border-radius: 10px; padding: 0 14px; }
  .panel-foot { padding: 11px 16px 13px; flex-direction: column; align-items: flex-start; gap: 9px; }
  .panel-features { gap: 10px 14px; }
  .inbox-card { border-radius: 14px; }
  .inbox-header { padding: 14px 16px 12px; }
  .inbox-title { font-size: 15px; }
  .mail-cards { padding: 0 10px 10px; }
  .mail-card { padding: 11px 13px; }
  .footer { padding: 14px; font-size: 11px; }
}
