.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.card .num {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.card .num.warn { color: var(--warn); }
.card .num.danger { color: var(--danger); }
.card .num.ok { color: var(--success); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  transition: background .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { background: #b8c1d4; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: white;
  color: var(--text);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: var(--bg-soft); border-color: #c3cdde; }
.btn-ghost:disabled { background: #f2f4f8; color: #a6afc2; border-color: var(--line); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #c93b40; }

.btn-success { background: var(--success); }
.btn-success:hover { background: #128a55; }

.btn-warn { background: var(--warn); color: white; }

.zh-pane { display: none; }
.zh-pane.active { display: block; }
.zh-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }

.input, .select {
  background: white;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border .15s, box-shadow .15s;
}
.input::placeholder { color: #9aa5ba; }
.input:hover, .select:hover { border-color: #c3cdde; }
.input:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input[readonly] { background: var(--bg-soft); color: var(--muted); }
.input.compact { padding: 5px 8px; font-size: 12px; }

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 12px; color: var(--muted); }

.table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  box-shadow: var(--shadow);
  max-height: 70vh;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
table.data thead th {
  background: #f5f7fb;
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid #eff2f9;
  vertical-align: top;
  font-variant-numeric: tabular-nums;
}
table.data tbody tr:hover { background: #f7f9fd; }
table.data tbody tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: #e8edf6;
  color: #4a5772;
}
.badge.ok { background: #ddf3e6; color: #14774a; }
.badge.warn { background: #fcefd5; color: #8a5b0b; }
.badge.bad { background: #fbdcdc; color: #ac2727; }
.badge.info { background: #dde9fc; color: #285ec0; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  background: #eef1f7;
  color: #4a5772;
  line-height: 1.6;
  white-space: nowrap;
}
.chip.ok { background: #ddf3e6; color: #14774a; }
.chip.warn { background: #fcefd5; color: #8a5b0b; }
.chip.bad { background: #fbdcdc; color: #ac2727; }
.chip.info { background: #dde9fc; color: #285ec0; }

.section-subtitle {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  margin: 6px 0;
}

.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  padding: 10px 0;
  font-size: 12.5px;
  color: var(--muted);
}

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(13, 20, 36, .42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  z-index: 100;
  animation: maskIn .12s ease-out;
}
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: white;
  border-radius: 12px;
  min-width: 360px;
  max-width: 80vw;
  max-height: 80vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .16s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: white;
  z-index: 2;
}
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 16px 18px; }
.modal-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  background: #fafbfd;
  position: sticky;
  bottom: 0;
}

.toast-host {
  position: fixed;
  top: 64px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}
.toast {
  background: white;
  border-left: 3px solid var(--primary);
  box-shadow: 0 4px 20px rgba(16, 24, 44, 0.14);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  min-width: 220px;
  max-width: 360px;
  animation: slideIn .2s ease-out;
  transition: opacity .2s, transform .2s;
}
.toast.ok { border-left-color: var(--success); }
.toast.warn { border-left-color: var(--warn); }
.toast.bad { border-left-color: var(--danger); }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.progress-bar {
  height: 6px;
  background: #ecf0f7;
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2b6cff, #18b6ff);
  transition: width .3s;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #e6eaf2;
  border-top-color: var(--primary);
  border-radius: 50%;
  display: inline-block;
  animation: spin 1s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 32px;
}

.section-divider {
  margin: 18px 0;
  border-top: 1px dashed var(--line);
}

details.foldable {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
}
details.foldable > summary {
  cursor: pointer;
  font-weight: 500;
}

.bulletin-table th, .bulletin-table td {
  text-align: center;
  white-space: nowrap;
}
.bulletin-table .group-name { text-align: left; font-weight: 500; }

/* 报表列表里的指标图片预览 */
.rp-png-name { display: flex; align-items: center; gap: 10px; text-align: left; }
.rp-thumb {
  width: 88px; height: 56px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--line); cursor: zoom-in; background: #f5f6f9;
  box-shadow: 0 1px 3px rgba(20,27,45,.12); transition: transform .12s;
}
.rp-thumb:hover { transform: scale(1.04); }
.rp-lightbox {
  position: fixed; inset: 0; z-index: 9999; display: none;
  align-items: center; justify-content: center;
  background: rgba(15,20,30,.82); cursor: zoom-out; padding: 32px;
}
.rp-lightbox-img {
  max-width: 96vw; max-height: 92vh; border-radius: 10px;
  box-shadow: 0 12px 48px rgba(0,0,0,.5); background: #fff;
}

/* ============ 邮件页：页签 + 联系人 + 选择器 ============ */
.btn-xs { padding: 2px 8px; font-size: 11px; border-radius: 6px; line-height: 1.4; }

.ml-tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 2px solid var(--line);
  margin-bottom: 16px;
}
.ml-tab {
  appearance: none; background: transparent; border: none; cursor: pointer;
  padding: 8px 16px; font-size: 14px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px; border-radius: 6px 6px 0 0;
  transition: color .12s, background .12s;
}
.ml-tab:hover { color: var(--text, #222); background: rgba(0,0,0,.03); }
.ml-tab.active {
  color: var(--accent); font-weight: 600; border-bottom-color: var(--accent);
}

/* 联系人表格 */
.ct-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ct-table th, .ct-table td {
  text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.ct-table thead th {
  font-size: 12px; color: var(--muted); font-weight: 600;
  background: rgba(0,0,0,.02); position: sticky; top: 0;
}
.ct-table tbody tr:hover { background: rgba(0,0,0,.02); }
.ct-chip {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  background: rgba(76,110,245,.12); color: var(--accent);
  font-size: 11px; line-height: 1.6;
}

/* 联系人选择器列表 */
.cp-list { display: flex; flex-direction: column; gap: 2px; }
.cp-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent;
}
.cp-row:hover { background: rgba(0,0,0,.03); }
.cp-row.on { background: rgba(76,110,245,.08); border-color: rgba(76,110,245,.25); }
.cp-row .cp-name { font-weight: 600; min-width: 70px; }
.cp-row .cp-email { color: var(--muted); flex: 1; }

/* ml-pane 默认隐藏，由 JS 切换显隐 */
.ml-pane { display: none; }

/* ============ 邮件页：每日定时点位 chips ============ */
.ml-schedchips {
  display: flex; flex-wrap: wrap; gap: 8px;
  min-height: 32px; padding: 4px 0;
}
.ml-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 6px 4px 10px; border-radius: 999px;
  background: rgba(76,110,245,.10); border: 1px solid rgba(76,110,245,.25);
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 13px; color: var(--accent, #3478f6); font-weight: 600;
}
.ml-chip-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent, #3478f6);
}
.ml-chip-x {
  appearance: none; background: transparent; border: none;
  cursor: pointer; padding: 0 4px; line-height: 1;
  font-size: 15px; color: var(--muted); border-radius: 50%;
  transition: background .15s, color .15s;
}
.ml-chip-x:hover { background: rgba(220,60,60,.15); color: var(--danger, #dc3c3c); }

/* ============ 邮件页：联系人二栏 ============ */
.ct-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px;
  align-items: stretch;
}
@media (max-width: 768px) {
  .ct-grid { grid-template-columns: 1fr; }
}
.ct-side { padding: 10px 0; max-height: 60vh; overflow: auto; }
.ct-side-title {
  padding: 0 14px 8px;
  font-size: 12px; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.ct-grouplist { list-style: none; margin: 0; padding: 0; }
.ct-groupitem {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 14px; cursor: pointer; font-size: 13px;
  border-left: 3px solid transparent; transition: background .12s, border-color .12s;
}
.ct-groupitem:hover { background: rgba(0,0,0,.03); }
.ct-groupitem.on {
  background: rgba(76,110,245,.08);
  border-left-color: var(--accent, #3478f6);
  font-weight: 600;
}
.ct-grouplabel {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; padding-right: 8px;
}
.ct-groupbadge {
  font-size: 11px; color: var(--muted);
  background: rgba(0,0,0,.06); border-radius: 999px;
  padding: 1px 8px; min-width: 22px; text-align: center;
}
.ct-groupitem.on .ct-groupbadge {
  background: rgba(76,110,245,.16); color: var(--accent, #3478f6);
}
.ct-main { min-height: 200px; }

/* ============ 概览页：状态卡 + KPI ============ */
.dash-status-card {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}
.dash-status-card::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--line-strong);
}
.dash-status-card.on::after { background: var(--success); }
.dash-status-card.off::after { background: var(--danger); }
.dash-status-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  font-size: 17px; flex-shrink: 0;
  background: var(--bg-soft); color: var(--muted);
}
.dash-status-card.on .dash-status-icon { background: #ddf3e6; color: #14774a; }
.dash-status-card.off .dash-status-icon { background: #fbdcdc; color: #ac2727; }
.dash-status-meta { min-width: 0; }
.dash-status-meta .t { font-size: 13px; font-weight: 600; }
.dash-status-meta .s {
  font-size: 12px; color: var(--muted); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dash-status-card.on .dash-status-meta .s.state { color: #14774a; }
.dash-status-card.off .dash-status-meta .s.state { color: #ac2727; }

.log-toolbar {
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.log-meta {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.log-viewer-wrap {
  padding: 0;
  overflow: hidden;
}
.log-viewer {
  margin: 0;
  padding: 12px 14px;
  min-height: 420px;
  max-height: calc(100vh - 280px);
  overflow: auto;
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 0 0 var(--radius) var(--radius);
}
.log-viewer:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
