/* =========================================================================
   app.css — 基础层（reset / 排版 / 布局 / 顶栏）
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

a { color: var(--brand-1); text-decoration: none; transition: color var(--dur-fast); }
a:hover { color: var(--brand-2); }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }

.muted { color: var(--muted); font-size: 12.5px; }

.app-shell { max-width: 1480px; margin: 0 auto; padding: 22px clamp(14px, 3vw, 34px) 60px; }

/* —— 顶栏 —— */
.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.topbar .brand {
  display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px;
}
.topbar .brand .logo {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand-grad); color: #fff; font-size: 17px;
  box-shadow: var(--shadow-brand);
}
.topbar .spacer { flex: 1; }
.topbar .host-pill {
  font: 12px var(--font-mono); color: var(--muted);
  padding: 5px 10px; border-radius: var(--r-pill);
  background: var(--surface-3); border: 1px solid var(--border);
}

/* —— 主题切换按钮 —— */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--surface-3); color: var(--text-soft);
  cursor: pointer; font-size: 13px;
  transition: all var(--dur-fast) var(--ease);
}
.theme-toggle:hover { color: var(--brand-1); border-color: var(--brand-1); transform: translateY(-1px); }

/* —— 卡片 —— */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  margin: 0 0 16px;
  box-shadow: var(--shadow-sm);
  animation: rise var(--dur-slow) var(--ease-out) both;
}
.card .card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.card .card-head h3 { font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.card .card-head .head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-title-row { display: flex; align-items: flex-start; gap: 12px; flex: 1 1 680px; flex-wrap: wrap; }
.list-title-row h3 { padding-top: 9px; }
.email-search-form {
  width: min(760px, 100%); display: grid; grid-template-columns: minmax(280px, 1fr) auto;
  gap: 8px; align-items: stretch;
}
.email-search {
  min-height: 76px; display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); color: var(--muted);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.email-search:focus-within { border-color: var(--brand-1); box-shadow: 0 0 0 3px var(--brand-ring); }
.email-search-icon { font-size: 17px; line-height: 1.4; }
.email-search textarea {
  min-width: 0; width: 100%; min-height: 56px; max-height: 190px; flex: 1; padding: 0; resize: vertical;
  border: 0; outline: 0; background: transparent; color: var(--text);
  font: 13px/1.45 var(--font-mono);
}
.email-search textarea::placeholder { color: var(--muted); font-family: var(--font-sans); }
.email-search-actions { display: flex; flex-direction: column; gap: 7px; }
.email-search-actions .btn { min-width: 72px; flex: 1; }
.email-search-hint { grid-column: 1 / -1; color: var(--muted); font-size: 11.5px; }
.list-filters { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.list-filter { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.filter-result { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* 卡片错峰入场 */
.card:nth-child(1) { animation-delay: 0ms; }
.card:nth-child(2) { animation-delay: 60ms; }
.card:nth-child(3) { animation-delay: 120ms; }
.card:nth-child(4) { animation-delay: 180ms; }

/* —— 工具栏（导入区）—— */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .hint { color: var(--muted); font-size: 12.5px; }

/* —— 文件选择 —— */
.file-drop {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: var(--r-md);
  border: 1.5px dashed var(--border); background: var(--surface-2);
  color: var(--text-soft); cursor: pointer; font-size: 13.5px;
  transition: all var(--dur-fast) var(--ease);
}
.file-drop:hover { border-color: var(--brand-1); color: var(--brand-1); background: var(--brand-soft); }
.file-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-drop .fname { font-weight: 600; color: var(--text); }

/* 进度条 */
.progress {
  margin-top: 14px; display: none;
}
.progress.show { display: block; animation: rise var(--dur) var(--ease-out) both; }
.progress .progress-top { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-soft); margin-bottom: 6px; }
.progress .progress-top #stage { font-weight: 600; color: var(--text); }
.progress .track {
  height: 10px; border-radius: var(--r-pill); overflow: hidden;
  background: var(--surface-3); border: 1px solid var(--border-soft);
}
.progress .bar {
  height: 100%; width: 0; border-radius: var(--r-pill);
  background: linear-gradient(90deg, #818cf8, #6366f1, #8b5cf6);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
  transition: width var(--dur) var(--ease);
}
@keyframes shimmer { to { background-position: -200% 0; } }
.progress .detail { margin-top: 7px; color: var(--muted); font-size: 12px; }

/* —— 统计卡 —— */
.stat-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
}
.stat {
  position: relative; overflow: hidden;
  padding: 12px 14px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast);
  animation: rise var(--dur-slow) var(--ease-out) both;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--brand-ring); }
.stat .label { color: var(--muted); font-size: 11.5px; line-height: 1.1; }
.stat .value { font-weight: 800; font-size: 20px; line-height: 1.3; margin-top: 4px;
  background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .value.muted-val { -webkit-text-fill-color: var(--text); color: var(--text); }
.stat::after {
  content: ""; position: absolute; right: -18px; top: -18px; width: 56px; height: 56px;
  border-radius: 50%; background: var(--brand-soft); filter: blur(8px);
}

/* —— 分页 —— */
.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.pager .pg {
  min-width: 36px; text-align: center;
  padding: 6px 10px; border-radius: var(--r-sm);
  border: 1px solid var(--border); color: var(--text-soft);
  background: var(--surface); cursor: pointer; font-size: 13px;
  transition: all var(--dur-fast) var(--ease);
}
.pager .pg:hover { border-color: var(--brand-1); color: var(--brand-1); transform: translateY(-1px); }
.pager .pg.current { background: var(--brand-grad); color: #fff; border-color: transparent; box-shadow: var(--shadow-brand); }
.pager .ellipsis { color: var(--muted); padding: 0 2px; }
.perpage { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }

/* 响应式 */
@media (max-width: 640px) {
  .app-shell { padding: 14px 12px 48px; }
  .topbar { border-radius: var(--r-md); }
  .list-title-row, .email-search-form, .email-search { width: 100%; }
  .list-title-row h3 { padding-top: 0; }
  .email-search-form { grid-template-columns: 1fr; }
  .email-search-actions { flex-direction: row; }
  .email-search-hint { grid-column: 1; }
  .list-filters { width: 100%; justify-content: flex-start; }
  .list-filter { flex: 1 1 145px; }
  .list-filter .select { flex: 1; min-width: 0; }
}

/* =========================================================================
   EA Signal Console v12
   ========================================================================= */
body {
  overflow-x: hidden;
  letter-spacing: 0.005em;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(127, 137, 122, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(127, 137, 122, 0.055) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 82%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 82%);
}

::selection { background: var(--brand-1); color: var(--bg); }

.app-shell {
  width: min(100%, 1600px);
  max-width: none;
  padding: 18px clamp(14px, 2.5vw, 40px) 72px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 100;
  min-height: 62px;
  margin-bottom: clamp(34px, 6vw, 78px);
  padding: 10px 12px 10px 16px;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  border-radius: var(--r-md);
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.12);
}
.topbar::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 14px;
  bottom: 14px;
  width: 3px;
  background: var(--brand-1);
  border-radius: 0 3px 3px 0;
}
.topbar .brand {
  gap: 11px;
  font: 800 15px/1 var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.topbar .brand .logo {
  position: relative;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--brand-1) 50%, var(--border));
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-1);
  box-shadow: none;
  font: 800 10px/1 var(--font-mono);
  letter-spacing: -0.04em;
}
.topbar .brand .logo::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 1px;
  background: currentColor;
  transform: rotate(-45deg);
}
.topbar .host-pill {
  position: relative;
  padding: 5px 10px 5px 20px;
  border: 0;
  background: transparent;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.topbar .host-pill::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
  transform: translateY(-50%);
}

.page-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.6fr);
  gap: clamp(28px, 6vw, 90px);
  align-items: end;
  max-width: 1360px;
  margin: 0 auto clamp(42px, 7vw, 88px);
  padding: 0 clamp(2px, 2vw, 30px);
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
  color: var(--brand-1);
  font: 700 11px/1.2 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.signal-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 5px var(--brand-soft), 0 0 24px currentColor;
}
.page-intro h1 {
  max-width: 920px;
  font: 800 clamp(42px, 6.3vw, 92px)/0.92 var(--font-display);
  letter-spacing: -0.065em;
}
.page-intro h1 em {
  display: block;
  color: var(--muted);
  font-style: normal;
  font-weight: 400;
}
.intro-meta {
  padding: 14px 0 13px 20px;
  border-left: 1px solid var(--border);
}
.intro-meta span {
  display: block;
  color: var(--muted);
  font: 700 10px/1.2 var(--font-mono);
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.intro-meta strong {
  display: block;
  margin: 8px 0 5px;
  font: 800 clamp(34px, 4vw, 58px)/1 var(--font-display);
  letter-spacing: -0.05em;
  color: var(--text);
}
.intro-meta small { color: var(--muted); font-size: 12px; }

.card {
  position: relative;
  overflow: hidden;
  max-width: 1530px;
  margin: 0 auto 18px;
  padding: clamp(18px, 2.2vw, 30px);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  animation: none;
}
.card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 88px;
  height: 2px;
  background: var(--brand-1);
}
.card::after {
  content: attr(data-section);
  position: absolute;
  top: 20px;
  right: 22px;
  color: var(--border);
  font: 800 clamp(28px, 4vw, 54px)/1 var(--font-display);
  letter-spacing: -0.05em;
  pointer-events: none;
}
.card .card-head { position: relative; z-index: 1; margin-bottom: 20px; }
.card .card-head h3 {
  gap: 10px;
  font: 800 12px/1.2 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.section-no { color: var(--brand-1); }

.import-card .toolbar {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto auto minmax(180px, 0.7fr);
  gap: 10px;
}
.import-card .file-drop { min-height: 50px; }
.toolbar .hint { line-height: 1.45; }

.file-drop {
  overflow: hidden;
  justify-content: flex-start;
  border-color: color-mix(in srgb, var(--brand-1) 35%, var(--border));
  background: linear-gradient(90deg, var(--brand-soft), transparent 70%);
}
.file-drop::after {
  content: "DROP";
  margin-left: auto;
  color: var(--muted);
  font: 700 10px/1 var(--font-mono);
  letter-spacing: 0.12em;
}

.progress .bar { background: var(--brand-grad); animation: none; }

.stats-card .card-head { align-items: flex-start; }
.stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--border);
}
.stat {
  min-height: 104px;
  padding: 17px 16px;
  border: 0;
  border-radius: 0;
  background: var(--surface-2);
  animation: none;
}
.stat:hover { z-index: 1; border-color: transparent; box-shadow: inset 0 -2px 0 var(--brand-1); }
.stat .label {
  font: 700 10px/1.2 var(--font-mono);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.stat .value {
  margin-top: 13px;
  background: none;
  color: var(--text);
  font: 800 29px/1 var(--font-display);
  letter-spacing: -0.04em;
}
.stat .value.muted-val { color: var(--muted); }
.stat::after {
  right: 14px;
  top: auto;
  bottom: 13px;
  width: 5px;
  height: 5px;
  filter: none;
  background: var(--brand-1);
}

.accounts-card { overflow: visible; }
.accounts-card::after { content: "03"; }
.list-title-row { flex-basis: 720px; }
.email-search { background: var(--surface-2); }
.email-search-icon { color: var(--brand-1); }
.list-filters {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.pager { justify-content: center; margin-top: 20px; }

@media (max-width: 980px) {
  .topbar { position: relative; top: 0; margin-bottom: 42px; }
  .topbar .spacer { display: none; }
  .topbar .host-pill { margin-right: auto; }
  .page-intro { grid-template-columns: 1fr; }
  .intro-meta { max-width: 320px; }
  .import-card .toolbar { grid-template-columns: 1fr 1fr; }
  .import-card .file-drop, .import-card .hint { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .app-shell { padding: 10px 10px 48px; }
  .topbar { gap: 8px; padding: 10px; }
  .topbar .brand { width: calc(100% - 48px); margin-right: auto; }
  .topbar .host-pill { order: 2; width: 100%; }
  .topbar .btn { flex: 1 1 auto; }
  .topbar .btn .ico { display: none; }
  .page-intro { margin-bottom: 38px; padding: 0 7px; }
  .page-intro h1 { font-size: clamp(40px, 15vw, 62px); }
  .intro-meta { padding-left: 15px; }
  .card { padding: 18px 14px; }
  .card::after { top: 16px; right: 14px; }
  .import-card .toolbar { grid-template-columns: 1fr; }
  .import-card .file-drop, .import-card .hint { grid-column: 1; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
