* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #f4f6fa; color: #1f2733;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: #1f3a5f; color: #fff;
}
.brand { font-weight: 600; font-size: 16px; }
.tag { font-size: 12px; background: #2e5a8f; padding: 2px 8px; border-radius: 10px; margin-left: 8px; }
.status { font-size: 13px; color: #9fe3a3; }

.tabs { display: flex; gap: 4px; padding: 0 16px; background: #fff; border-bottom: 1px solid #e3e8ef; }
.tab {
  border: none; background: none; padding: 12px 16px; cursor: pointer;
  font-size: 14px; color: #5a6b80; border-bottom: 2px solid transparent;
}
.tab.active { color: #1f3a5f; border-bottom-color: #1f3a5f; font-weight: 600; }

main { padding: 20px; max-width: 1080px; margin: 0 auto; }
.panel { display: none; background: #fff; padding: 20px; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.panel.active { display: block; }
.panel h2 { margin-top: 0; font-size: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; }

.form-row { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.form-row.inline { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
.form-row label { font-size: 13px; color: #5a6b80; }
input, textarea, select {
  padding: 8px 10px; border: 1px solid #d3dae5; border-radius: 6px; font-size: 14px; font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: #1f3a5f; }
textarea { resize: vertical; }

.btn {
  padding: 8px 16px; border: 1px solid #c2cdda; background: #fff; border-radius: 6px;
  cursor: pointer; font-size: 14px; color: #1f3a5f;
}
.btn:hover { background: #f0f4f9; }
.btn.primary { background: #1f3a5f; color: #fff; border-color: #1f3a5f; }
.btn.primary:hover { background: #2a4d7a; }
.btn.danger { color: #c0392b; border-color: #e0a99f; }
.result { margin-left: 12px; font-size: 13px; }
.hint { font-size: 13px; color: #7a8699; }

.msg-list, .rule-list, .acc-list { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg {
  border: 1px solid #e3e8ef; border-radius: 8px; padding: 12px 14px; background: #fafcff;
}
.msg .m-head { display: flex; justify-content: space-between; font-size: 13px; color: #5a6b80; margin-bottom: 6px; }
.msg .m-subj { font-weight: 600; color: #1f2733; margin-bottom: 4px; }
.msg .m-body { font-size: 13px; white-space: pre-wrap; color: #3a4658; max-height: 120px; overflow: auto; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 8px; }
.badge.sent { background: #e3f3e6; color: #2e7d32; }
.badge.received { background: #e6f0fb; color: #1f6fb2; }
.badge.forwarded { background: #fdeede; color: #b5761a; }
.badge.failed { background: #fbe3e0; color: #c0392b; }
.badge.forwarding { background: #fff3cd; color: #8a6d00; }

.rule, .acc {
  display: flex; align-items: center; gap: 10px; border: 1px solid #e3e8ef;
  border-radius: 8px; padding: 10px 14px; font-size: 13px; flex-wrap: wrap;
}
.rule .r-info, .acc .a-info { flex: 1; min-width: 240px; }
.muted { color: #8a96a8; }
