/* ==========================================================================
   yyp 邮件系统管理台 —— 组件层
   规则（来自 qqmail-ui skill，不改）：
     · 组件里不写 hex，只消费 --base_* / --theme_* / --radius-* / --shadow_*
     · 状态 = 重绑层3变量（--bg / --hover-bg / --active-bg），不新写样式属性
     · 字重只有 400 / 700；未读/选中 = 700，不改颜色
     · hover 不加 transition（只有展开/位移类才 100-300ms）
     · 圆角只用 2/4/6/8/12/50%
   ========================================================================== */

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg_gray_web_0);
  color: var(--base_gray_100);
  font-family: var(--font-ui);
  font-size: var(--fs-13);
  line-height: var(--lh-13);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--theme_primary); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--theme_alpha_040);
  outline-offset: 2px;
}

/* ---------- 外壳 ---------- */

.hd {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: var(--bg_white_web);
  border-bottom: 1px solid var(--base_gray_007);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-16);
  line-height: var(--lh-16);
  font-weight: 700;
  color: var(--base_gray_100);
}

.brand-mark {
  width: 24px; height: 24px;
  border-radius: var(--radius-md);
  background: var(--theme_primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: .3px;
}

.brand-sub {
  color: var(--base_gray_050);
  font-weight: 400;
  font-size: var(--fs-12);
}

.hd-spacer { flex: 1; }

.who {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px;
  border-radius: var(--radius-md);
  --bg: transparent;
  --hover-bg: var(--base_gray_005);
  background: var(--bg);
  color: var(--base_gray_080);
  font-size: var(--fs-12);
}
.who:hover { background: var(--hover-bg); text-decoration: none; }

.bd { display: flex; height: calc(100vh - var(--header-h)); }

/* ---------- 侧栏 ---------- */

.side {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  padding: 12px 12px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}

.side-group-title {
  padding: 0 8px;
  color: var(--base_gray_080);
  font-size: var(--fs-12);
  line-height: var(--lh-12);
  font-weight: 700;
}

.menu { display: flex; flex-direction: column; gap: 2px; }

.mi {
  height: var(--menu-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  --bg: transparent;
  --hover-bg: var(--base_gray_005);
  --active-bg: var(--base_gray_010);
  background: var(--bg);
  color: var(--base_gray_080);
  font-weight: 400;
}
.mi:hover { background: var(--hover-bg); text-decoration: none; }
.mi:active { background: var(--active-bg); }

.mi.on {
  --bg: var(--theme_alpha_010);
  --hover-bg: var(--theme_alpha_015);
  --active-bg: var(--theme_alpha_020);
  color: var(--theme_primary);
  font-weight: 700;
}

.mi .ico { width: 16px; height: 16px; flex: 0 0 16px; color: currentColor; opacity: .85; }
.mi .cnt {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: var(--radius-xs);
  background: var(--base_gray_005);
  color: var(--base_gray_050);
  font-size: var(--fs-11);
  line-height: 18px;
  text-align: center;
  font-weight: 400;
}

/* ---------- 内容卡 ---------- */

.main { flex: 1; min-width: 0; padding-right: 16px; }

.card {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg_white_web);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  overflow: hidden;
}

.tbar {
  flex: 0 0 auto;
  height: var(--toolbar-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--base_gray_007);
}

.tbar-title {
  font-size: var(--fs-14);
  line-height: var(--lh-14);
  font-weight: 700;
  margin-right: 8px;
}

.tbar-spacer { flex: 1; }

.body { flex: 1; overflow: auto; }

/* ---------- 按钮 ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--base_gray_010);
  border-radius: var(--radius-sm);
  --bg: var(--bg_white_web);
  --hover-bg: var(--base_gray_005);
  --active-bg: var(--base_gray_010);
  background: var(--bg);
  color: var(--base_gray_080);
  font-family: inherit;
  font-size: var(--fs-13);
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: transparent;
  pointer-events: none;
}
.btn:hover { background: var(--hover-bg); }
.btn:hover::before { background: var(--base_gray_005); }
.btn:active::before { background: var(--base_gray_010); }

.btn-sm { height: 24px; padding: 0 8px; font-size: var(--fs-12); border-radius: var(--radius-xs); }

.btn-primary {
  border-color: var(--theme_primary);
  --bg: var(--theme_primary);
  --hover-bg: var(--theme_primary);
  --active-bg: var(--theme_darken_1);
  background: var(--bg);
  color: #fff;
  box-shadow: var(--material_BlueButton_Medium);
}
.btn-primary:hover::before { background: var(--base_white_015); }
.btn-primary:active::before { background: var(--base_white_025); }

.btn-danger { color: var(--chrome_pink); border-color: var(--base_gray_010); }
.btn-danger:hover::before { background: var(--base_gray_005); }

.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- 输入 ---------- */

.inp {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--base_gray_010);
  border-radius: var(--radius-md);
  background: var(--bg_gray_web_2);
  color: var(--base_gray_100);
  font-family: inherit;
  font-size: var(--fs-13);
}
.inp::placeholder { color: var(--base_gray_040); }
.inp:hover { background: var(--base_gray_005); }
.inp:focus {
  background: var(--bg_white_web);
  border-color: var(--theme_primary);
  outline: none;
  box-shadow: 0 0 0 2px var(--theme_alpha_015);
}

.field { display: flex; flex-direction: column; gap: 4px; }
.field > label { color: var(--base_gray_080); font-size: var(--fs-12); line-height: var(--lh-12); }
.hint { color: var(--base_gray_040); font-size: var(--fs-11); line-height: var(--lh-11); }

/* ---------- 列表行（核心手感：28px + 13px） ---------- */

.list { display: flex; flex-direction: column; }

.list-hd {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 16px;
  border-bottom: 1px solid var(--base_gray_007);
  color: var(--base_gray_050);
  font-size: var(--fs-12);
  line-height: var(--lh-12);
  position: sticky;
  top: 0;
  background: var(--bg_white_web);
  z-index: 1;
}

.row {
  display: flex;
  align-items: center;
  height: var(--row-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--base_gray_007);
  --bg: transparent;
  --hover-bg: var(--base_gray_005);
  background: var(--bg);
}
.row:hover { background: var(--hover-bg); }
.row.unread { font-weight: 700; }
.row.off { color: var(--base_gray_040); }

.cell {
  min-width: 0;
  padding-right: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell.num { font-family: var(--font-num); text-align: right; color: var(--base_gray_050); }
.cell.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--fs-12); }
.cell.w-addr { flex: 0 0 260px; }
.cell.w-220 { flex: 0 0 220px; }
.cell.w-140 { flex: 0 0 140px; }
.cell.w-110 { flex: 0 0 110px; }
.cell.w-90 { flex: 0 0 90px; }
.cell.w-70 { flex: 0 0 70px; }
.cell.grow { flex: 1; }

/* ---------- 标签 / 状态 ---------- */

.tag {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 4px;
  border-radius: var(--radius-xs);
  background: var(--base_gray_005);
  color: var(--base_gray_050);
  font-size: var(--fs-11);
  line-height: 18px;
  font-weight: 400;
  white-space: nowrap;
}

.dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: var(--radius-pill);
  margin-right: 6px;
  vertical-align: 1px;
  background: var(--base_gray_030);
}
.dot.sent { background: var(--chrome_green); }
.dot.bounced { background: var(--chrome_pink); }
.dot.deferred { background: var(--chrome_orange); }
.dot.queued { background: var(--chrome_cyan); }
.dot.submit_failed { background: var(--chrome_pink); }
.dot.expired { background: var(--base_gray_040); }

/* ---------- 统计卡 ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  padding: 16px;
}

.stat {
  padding: 12px 14px;
  border: 1px solid var(--base_gray_007);
  border-radius: var(--radius-lg);
  background: var(--bg_gray_web_3);
}
.stat .k { color: var(--base_gray_050); font-size: var(--fs-12); line-height: var(--lh-12); }
.stat .v {
  margin-top: 4px;
  font-family: var(--font-num);
  font-size: var(--fs-20);
  line-height: var(--lh-20);
  font-weight: 700;
}
.stat .s { margin-top: 2px; color: var(--base_gray_040); font-size: var(--fs-11); line-height: var(--lh-11); }

/* ---------- 表单块 ---------- */

.panel {
  margin: 16px;
  padding: 14px 16px;
  border: 1px solid var(--base_gray_007);
  border-radius: var(--radius-lg);
  background: var(--bg_gray_web_3);
}
.panel-title {
  font-size: var(--fs-14);
  line-height: var(--lh-14);
  font-weight: 700;
  margin-bottom: 12px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  align-items: end;
}

/* ---------- 提示 ---------- */

.flash {
  margin: 12px 16px 0;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--base_gray_007);
  background: var(--bg_gray_web_3);
  color: var(--base_gray_080);
  font-size: var(--fs-12);
}
.flash.ok { border-color: var(--chrome_green_lighten_4l); background: var(--chrome_green_lighten_5); }
.flash.err { border-color: var(--chrome_pink_lighten_4l); background: var(--chrome_pink_lighten_5); }

.empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--base_gray_040);
  font-size: var(--fs-12);
}

code, .kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--fs-12);
  padding: 1px 4px;
  border-radius: var(--radius-xs);
  background: var(--base_gray_005);
}

/* ---------- 登录页 ---------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 360px;
  padding: 24px;
  background: var(--bg_white_web);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow_3);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card h1 {
  margin: 0 0 2px;
  font-size: var(--fs-20);
  line-height: var(--lh-20);
  font-weight: 700;
}
.login-card .sub { color: var(--base_gray_050); font-size: var(--fs-12); }

@media (max-width: 900px) {
  .side { display: none; }
  .main { padding-right: 0; }
  .card { border-radius: 0; }
}
