:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --border: #e6eaf1;
  --border-strong: #d5dbe6;
  --text: #13161c;
  --text-2: #4b5565;
  --muted: #8792a6;
  --brand: #2b5cff;
  --brand-weak: #eef2ff;
  --danger: #e0324a;
  --danger-weak: #fdeef0;
  --warn: #d97a00;
  --warn-weak: #fff6e6;
  --ok: #0f9d58;
  --ok-weak: #e9f7ef;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 14px rgba(16, 24, 40, .05);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ============ 登录 ============ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1000px 500px at 15% 0%, #e8eeff 0%, transparent 60%),
    radial-gradient(900px 500px at 90% 100%, #eaf6ff 0%, transparent 55%),
    var(--bg);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 34px 32px 26px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, .09);
}

.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 26px; }
.logo-mark {
  width: 44px; height: 44px; flex: 0 0 44px;
  border-radius: 12px;
  background: linear-gradient(140deg, #2b5cff, #4f7cff);
  color: #fff; font-size: 20px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(43, 92, 255, .3);
}
.logo-mark.sm { width: 34px; height: 34px; flex: 0 0 34px; font-size: 16px; border-radius: 9px; }
.login-brand h1 { font-size: 19px; font-weight: 650; letter-spacing: -.2px; }
.login-brand p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.login-form label { display: block; margin-bottom: 15px; }
.login-form label span {
  display: block; font-size: 12.5px; color: var(--text-2);
  margin-bottom: 7px; font-weight: 500;
}
.login-form input {
  width: 100%; height: 42px; padding: 0 13px;
  border: 1px solid var(--border-strong); border-radius: 9px;
  font-size: 14px; color: var(--text); background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.login-form input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(43, 92, 255, .12);
}
.btn-primary {
  width: 100%; height: 42px; margin-top: 6px;
  background: var(--brand); color: #fff; border: 0; border-radius: 9px;
  font-size: 14.5px; font-weight: 550; cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: #1f4ae0; }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.login-error { color: var(--danger); font-size: 12.5px; margin-top: 10px; min-height: 17px; }
.login-hint { text-align: center; font-size: 11.5px; color: var(--muted); margin-top: 16px; }

/* ============ 布局 ============ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px; flex: 0 0 232px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.35; }
.brand-text strong { font-size: 13.5px; font-weight: 620; }
.brand-text span { font-size: 11.5px; color: var(--muted); }

nav { padding: 10px 9px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; border-radius: 8px;
  color: var(--text-2); text-decoration: none;
  font-size: 13.3px; cursor: pointer;
  transition: background .13s, color .13s;
  position: relative;
}
.nav-item i {
  font-style: normal; font-size: 13px; width: 15px;
  text-align: center; opacity: .55;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--brand-weak); color: var(--brand); font-weight: 550; }
.nav-item.active i { opacity: 1; }
.nav-badge {
  margin-left: auto; font-style: normal; font-size: 11px;
  background: var(--brand); color: #fff;
  padding: 1px 6px; border-radius: 20px; font-weight: 600;
}
.nav-badge.danger { background: var(--danger); }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }
.data-status {
  font-size: 11px; color: var(--muted); line-height: 1.55;
  background: var(--surface-2); border-radius: 8px; padding: 8px 10px;
}
.data-status b { color: var(--text-2); font-weight: 600; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 62px; flex: 0 0 62px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; gap: 16px;
  position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.topbar-left h2 { font-size: 16px; font-weight: 640; letter-spacing: -.2px; white-space: nowrap; }
.page-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.range-switch {
  display: flex; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 2px;
  flex-wrap: nowrap; overflow-x: auto; max-width: 100%;
}
.range-switch button {
  border: 0; background: transparent; color: var(--text-2);
  font-size: 12px; padding: 5px 8px; border-radius: 6px;
  cursor: pointer; font-family: inherit; white-space: nowrap;
}
/* 8 档按钮在窄屏上不能把顶栏撑破：允许横向压缩，不换行 */
@media (max-width: 1420px) {
  .range-switch button { padding: 5px 6px; font-size: 11.5px; }
}
.range-switch button.active { background: var(--surface); color: var(--text); font-weight: 550; box-shadow: var(--shadow); }

/* 自定义按钮与固定档位之间加一道竖线，视觉上分成两组 */
#customRangeBtn {
  border-left: 1px solid var(--border);
  border-radius: 0 6px 6px 0; margin-left: 3px; padding-left: 10px;
}

/* 自定义日期区间弹出面板 */
.range-pop {
  position: fixed; top: 70px; right: 22px; z-index: 40; width: 304px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 10px; box-shadow: 0 12px 34px rgba(19, 22, 28, .16);
  padding: 14px 16px 13px;
}
.range-pop-title { font-size: 13px; font-weight: 620; margin-bottom: 10px; }
.range-pop-row { display: flex; align-items: flex-end; gap: 8px; }
.range-pop-row label {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px;
  font-size: 11.5px; color: var(--muted);
}
.range-pop-row input {
  height: 30px; width: 100%; border: 1px solid var(--border); border-radius: 6px;
  padding: 0 7px; font-family: inherit; font-size: 12.5px; color: var(--text);
  background: var(--surface-2);
}
.range-pop-row input:focus { outline: none; border-color: var(--brand); }
.range-pop-sep { color: var(--muted); font-size: 12px; padding-bottom: 7px; }
.range-pop-tip { font-size: 11px; color: var(--muted); margin-top: 9px; line-height: 1.65; }
.range-pop-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.range-pop-actions .flex-spacer { flex: 1; }

/* 邮箱选择器：默认「全部邮箱」。选中单个邮箱后高亮，提醒"你现在看的不是全量" */
.acct-select {
  height: 32px; padding: 0 8px; max-width: 205px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); color: var(--text-2);
  font-size: 12.5px; font-family: inherit; cursor: pointer;
}
.acct-select:hover { border-color: var(--brand); color: var(--brand); }
.acct-select.active {
  background: var(--brand-weak); color: var(--brand);
  border-color: var(--brand); font-weight: 550;
}

.btn-ghost {
  height: 32px; padding: 0 13px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-2); border-radius: 8px; font-size: 12.5px;
  cursor: pointer; font-family: inherit;
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost:disabled { opacity: .55; cursor: wait; }

.user-chip { display: flex; align-items: center; gap: 8px; padding-left: 12px; border-left: 1px solid var(--border); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand-weak); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.3; }
.user-meta strong { font-size: 12.5px; font-weight: 600; }
.user-meta span { font-size: 11px; color: var(--muted); }
.btn-link {
  border: 0; background: none; color: var(--muted);
  font-size: 12px; cursor: pointer; padding: 4px; font-family: inherit;
}
.btn-link:hover { color: var(--danger); }

/* ============ 内容 ============ */
.content { padding: 20px 22px 40px; flex: 1; }
.loading { padding: 60px; text-align: center; color: var(--muted); font-size: 13px; }

.data-banner {
  margin: 14px 22px 0;
  background: var(--warn-weak); border: 1px solid #f5d9a8;
  color: #8a5a00; border-radius: 10px;
  padding: 10px 14px; font-size: 12.5px; line-height: 1.6;
  display: flex; gap: 10px; align-items: flex-start;
}
.data-banner strong { font-weight: 650; }

.section-title {
  font-size: 13px; font-weight: 620; color: var(--text-2);
  margin: 22px 0 11px; display: flex; align-items: center; gap: 8px;
}
.section-title:first-child { margin-top: 0; }
.section-title small { font-weight: 400; color: var(--muted); font-size: 11.5px; }

/* KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 1400px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1000px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 16px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi-card .label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.kpi-card .value {
  font-size: 26px; font-weight: 640; letter-spacing: -.6px;
  margin-top: 7px; font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 5px;
}
.kpi-card .value small { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.kpi-card .foot { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.kpi-card.danger .value { color: var(--danger); }
.kpi-card.warn .value { color: var(--warn); }
.kpi-card.ok .value { color: var(--ok); }
.kpi-card .tag {
  position: absolute; top: 12px; right: 12px;
  font-size: 10.5px; padding: 2px 7px; border-radius: 5px;
  background: var(--surface-2); color: var(--muted); font-weight: 500;
}
.kpi-card .tag.bad { background: var(--danger-weak); color: var(--danger); }
.kpi-card .tag.good { background: var(--ok-weak); color: var(--ok); }
.kpi-hint { font-size: 10.5px; color: var(--muted); margin-top: 3px; }

/* 卡片 */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-32 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
@media (max-width: 1180px) {
  .grid-2, .grid-3, .grid-32 { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; gap: 10px;
}
.card-head h3 { font-size: 13.5px; font-weight: 620; }
.card-head .hint { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.chart { width: 100%; height: 260px; }
.chart.tall { height: 320px; }
.chart.short { height: 200px; }

/* 表格 */
.table-wrap { overflow-x: auto; max-height: 620px; overflow-y: auto; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 12.7px; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); color: var(--text-2);
  font-weight: 600; font-size: 11.8px;
  text-align: left; padding: 9px 10px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 9px 10px; border-bottom: 1px solid #f0f3f8; vertical-align: middle; }
tbody tr:hover { background: #fafcff; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); }
.cell-ellipsis { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-sub { color: var(--muted); font-size: 11.3px; margin-top: 2px; }

/* 徽章 */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.3px; padding: 2px 8px; border-radius: 6px;
  font-weight: 550; white-space: nowrap;
}
.badge.red { background: var(--danger-weak); color: var(--danger); }
.badge.orange { background: var(--warn-weak); color: var(--warn); }
.badge.blue { background: var(--brand-weak); color: var(--brand); }
.badge.green { background: var(--ok-weak); color: var(--ok); }
.badge.gray { background: #f0f2f6; color: var(--text-2); }
.badge.purple { background: #f3efff; color: #6b46d6; }

/* 筛选 chips */
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  font-size: 12px; padding: 5px 11px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); cursor: pointer; font-family: inherit;
}
.chip.active { background: var(--brand-weak); border-color: #c9d6ff; color: var(--brand); font-weight: 550; }

/* 告警 */
.alert-list { display: flex; flex-direction: column; gap: 9px; }
.alert-item {
  display: flex; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); align-items: flex-start;
}
.alert-item.critical { border-left: 3px solid var(--danger); background: #fffdfd; }
.alert-item.warning { border-left: 3px solid var(--warn); }
.alert-item.info { border-left: 3px solid var(--brand); }
.alert-icon { font-size: 14px; line-height: 1.5; }
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-size: 13.2px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alert-detail { font-size: 12px; color: var(--text-2); margin-top: 4px; line-height: 1.55; }
.alert-action {
  font-size: 11.8px; color: var(--brand); margin-top: 5px;
  background: var(--brand-weak); padding: 4px 9px; border-radius: 6px;
  display: inline-block;
}
.alert-meta { font-size: 11px; color: var(--muted); margin-top: 5px; }
.alert-side { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.btn-mini {
  font-size: 11.5px; padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-2); cursor: pointer; font-family: inherit; white-space: nowrap;
}
.btn-mini:hover { border-color: var(--brand); color: var(--brand); }
.btn-mini.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-mini.primary:hover { background: #1f4ae0; }

/* 总结文档 */
.summary-doc {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px 30px; box-shadow: var(--shadow);
  max-width: 880px;
}
.summary-doc h2 { font-size: 18px; font-weight: 650; margin-bottom: 6px; letter-spacing: -.3px; }
.summary-period { font-size: 12px; color: var(--muted); margin-bottom: 18px; }
.summary-headline {
  font-size: 14px; line-height: 1.75; color: var(--text);
  background: var(--brand-weak); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 22px;
  border-left: 3px solid var(--brand);
}
.summary-section { margin-bottom: 20px; }
.summary-section h4 {
  font-size: 13.5px; font-weight: 620; margin-bottom: 9px;
  color: var(--text); padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.summary-section ul { list-style: none; }
.summary-section li {
  font-size: 13px; line-height: 1.78; color: var(--text-2);
  padding-left: 15px; position: relative; margin-bottom: 5px;
}
.summary-section li::before {
  content: ""; position: absolute; left: 0; top: 9px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--brand); opacity: .6;
}
.summary-actions { display: flex; gap: 9px; margin-bottom: 18px; }

/* 反哺 */
.insight-block { margin-bottom: 16px; }
.insight-block h4 { font-size: 13px; font-weight: 620; margin-bottom: 9px; }
.insight-line {
  font-size: 12.8px; line-height: 1.7; color: var(--text-2);
  padding: 9px 12px; background: var(--surface-2);
  border-radius: 8px; margin-bottom: 7px;
  border-left: 2px solid var(--brand);
}
.priority-bar {
  display: inline-block; height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, #ffb020, #e0324a);
  vertical-align: middle;
}

/* 质检 */
.score-ring { display: flex; align-items: center; gap: 16px; }
.issue-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border-radius: 8px;
  background: var(--surface-2); margin-bottom: 7px;
}
.issue-row .sev {
  font-size: 10.5px; font-weight: 650; padding: 2px 7px;
  border-radius: 5px; flex: 0 0 auto;
}
.sev.P0 { background: var(--danger-weak); color: var(--danger); }
.sev.P1 { background: var(--warn-weak); color: var(--warn); }
.sev.P2 { background: #eef1f6; color: var(--text-2); }
.sev.D { background: #f3efff; color: #6b46d6; }
.issue-msg { font-size: 12.5px; color: var(--text-2); line-height: 1.55; }
.issue-code { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

textarea {
  width: 100%; min-height: 130px; padding: 12px;
  border: 1px solid var(--border-strong); border-radius: 9px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  resize: vertical; color: var(--text); background: var(--surface);
}
textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(43,92,255,.1); }
select, input[type=text], input[type=password] {
  height: 34px; padding: 0 10px; border: 1px solid var(--border-strong);
  border-radius: 8px; font-size: 12.8px; font-family: inherit;
  color: var(--text); background: var(--surface);
}
select:focus, input:focus { outline: none; border-color: var(--brand); }

.empty { text-align: center; color: var(--muted); font-size: 12.5px; padding: 40px 0; }
.form-row { display: flex; gap: 9px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.form-row label { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--text-2); }
.stat-line { display: flex; justify-content: space-between; font-size: 12.5px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.stat-line:last-child { border-bottom: 0; }
.stat-line b { font-variant-numeric: tabular-nums; }

/* ============ 会话详情抽屉 ============ */
.drawer { position: fixed; inset: 0; z-index: 80; }
.drawer-mask {
  position: absolute; inset: 0;
  background: rgba(16, 24, 40, .32);
  backdrop-filter: blur(2px);
  animation: fadeIn .18s ease;
}
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(760px, 92vw);
  background: var(--surface);
  box-shadow: -12px 0 40px rgba(16, 24, 40, .14);
  display: flex; flex-direction: column;
  animation: slideIn .22s cubic-bezier(.22, .8, .3, 1);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(28px); opacity: .6; } to { transform: none; opacity: 1; } }

.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.drawer-title h3 { font-size: 15px; font-weight: 650; line-height: 1.45; }
.drawer-title span { font-size: 11.5px; color: var(--muted); display: block; margin-top: 4px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 22px 40px; }

.conv-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.conv-stat {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 9px; padding: 8px 12px; min-width: 84px;
}
.conv-stat .k { font-size: 10.5px; color: var(--muted); }
.conv-stat .v { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }

/* 对话时间线 */
.timeline { position: relative; padding-left: 0; }
.tl-item { display: flex; flex-direction: column; margin-bottom: 16px; position: relative; }
.tl-item.in { align-items: flex-start; }
.tl-item.out { align-items: flex-end; }
.tl-meta {
  font-size: 10.5px; color: var(--muted); margin-bottom: 5px;
  display: flex; gap: 7px; align-items: center;
}
.tl-bubble {
  max-width: 86%; border-radius: 12px; padding: 10px 13px;
  font-size: 12.5px; line-height: 1.62; white-space: pre-wrap;
  word-break: break-word;
}
.tl-item.in .tl-bubble {
  background: var(--surface-2); border: 1px solid var(--border);
  border-top-left-radius: 3px; color: var(--text);
}
.tl-item.out .tl-bubble {
  background: var(--brand-weak); border: 1px solid #dbe4ff;
  border-top-right-radius: 3px; color: #1b2b57;
}
.tl-who { font-weight: 600; color: var(--text-2); }
.tl-item.out .tl-who { color: var(--brand); }
.tl-tag {
  font-size: 10px; padding: 1px 6px; border-radius: 4px;
  background: #eef1f6; color: var(--text-2);
}
.tl-gap {
  font-size: 10.5px; color: var(--warn); background: var(--warn-weak);
  padding: 2px 8px; border-radius: 5px; align-self: center; margin: -6px 0 10px;
}

/* 会话列表行可点 */
.thread-row { cursor: pointer; transition: background .12s; }
.thread-row:hover { background: #f7f9fe; }
.depth-bar {
  display: flex; height: 7px; border-radius: 4px; overflow: hidden;
  background: #eef1f6; width: 100px;
}
.depth-bar i { display: block; height: 100%; }

/* ============ 安全：强制改密弹窗 ============ */
.modal-wrap {
  position: fixed; inset: 0; z-index: 120;
  display: flex; align-items: center; justify-content: center;
  /* 不用 backdrop-filter：它会把自身背景合成到子元素之上，弹窗看起来像半透明 */
  background: rgba(16, 24, 40, .48);
  padding: 24px;
}
.modal-card {
  width: min(440px, 100%);
  background: var(--surface);
  border-radius: 14px;
  padding: 26px 26px 20px;
  box-shadow: 0 24px 60px rgba(16, 24, 40, .22);
  display: flex; flex-direction: column; gap: 4px;
  animation: popIn .2s cubic-bezier(.22, .8, .3, 1);
}
/* 只做位移不做透明度：透明度动画在部分无头/低性能渲染下会停在中间帧，
   弹窗看起来像半透明、文字发灰 */
@keyframes popIn { from { transform: translateY(8px) scale(.985); } to { transform: none; } }
.modal-card h2 { font-size: 17px; font-weight: 650; letter-spacing: -.2px; }
.modal-sub { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin-bottom: 6px; }

.pwd-meter {
  height: 5px; background: #eef1f6; border-radius: 3px; overflow: hidden;
  margin: -2px 0 2px;
}
.pwd-meter i {
  display: block; height: 100%; width: 0;
  background: var(--danger); border-radius: 3px;
  transition: width .18s ease, background .18s ease;
}
.pwd-rules { font-size: 11px; color: var(--muted); line-height: 1.55; margin-bottom: 4px; }
.pwd-rules.bad { color: var(--danger); }
.pwd-rules.good { color: var(--ok); }

/* 登录页警告条 */
.login-warn {
  margin-top: 10px; padding: 9px 12px;
  background: var(--warn-weak); border: 1px solid #f3e0c2; border-radius: 8px;
  font-size: 11.5px; color: #8a5300; line-height: 1.6;
}

/* ============ 安全面板 ============ */
.sec-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 1100px) { .sec-grid { grid-template-columns: 1fr; } }

.sec-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--border);
  font-size: 12.5px;
}
.sec-row:last-child { border-bottom: none; }
.sec-row .k { color: var(--text-2); }
.sec-row .v { font-weight: 600; font-variant-numeric: tabular-nums; }

.sec-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px;
}
.sec-badge.ok { background: var(--ok-weak); color: #0a7a44; }
.sec-badge.bad { background: var(--danger-weak); color: #b3213a; }
.sec-badge.warn { background: var(--warn-weak); color: #8a5300; }
.sec-badge.info { background: var(--brand-weak); color: #1b3fc4; }

.audit-table td { font-size: 12px; }
.audit-table .mono { font-family: var(--mono); font-size: 11.5px; }
.audit-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 12.5px; }
.tag-act {
  font-size: 10.5px; padding: 1px 7px; border-radius: 4px; font-weight: 600;
  background: #eef1f6; color: var(--text-2); white-space: nowrap;
}
.tag-act.risk { background: var(--danger-weak); color: #b3213a; }
.tag-act.good { background: var(--ok-weak); color: #0a7a44; }

/* ============ 邮件数量对账 ============ */
.mm-acc-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 2px 0 9px; border-bottom: 1px solid var(--border); margin-bottom: 2px;
  font-size: 13px;
}
.mm-acc-head strong { font-size: 13px; font-weight: 600; }

.mm-verdict {
  margin-top: 12px; padding: 9px 12px; border-radius: 8px;
  background: var(--warn-weak); color: #8a5300;
  font-size: 12.5px; line-height: 1.6;
}

/* ---------- AI 客服配置 ---------- */
.ai-row { padding: 14px 0; border-top: 1px solid var(--border); }
.ai-row:first-child { border-top: 0; padding-top: 4px; }
.ai-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ai-mail { font-size: 13.5px; font-weight: 550; color: var(--text); }
.ai-opts { display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--text-2); }
.ai-opts label { color: var(--muted); margin-right: 5px; }
.ai-opts select, .ai-opts input[type=time] {
  height: 30px; padding: 0 7px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface); color: var(--text); font-size: 12.5px; font-family: inherit;
}
.ai-status { margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.7; }
.ai-status b { color: var(--text-2); font-weight: 500; }
.ai-note { margin-top: 8px; font-size: 12px; color: #d97a00; }
.switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 38px; height: 21px; border-radius: 20px; background: #d5dae3;
  transition: background .15s; display: inline-block; position: relative;
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px;
  border-radius: 50%; background: #fff; transition: transform .15s;
  box-shadow: 0 1px 2px rgba(0,0,0,.18);
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(17px); }
