* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  background: #f5f7fa;
  color: #2c3e50;
}
header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 2px solid #3498db;
  padding-bottom: 10px;
  margin-bottom: 30px;
}
header h1 { margin: 0; color: #2c3e50; }
.sub { color: #7f8c8d; margin: 5px 0 0; font-size: 14px; }
.logout-btn {
  background: #95a5a6;
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
.logout-btn:hover { background: #7f8c8d; }
section {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
h2 { margin-top: 0; color: #34495e; font-size: 18px; }
form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.domain-input { width: 220px; }
.path-input { width: 180px; }
.port-input { width: 150px; }
.sep { color: #95a5a6; font-size: 16px; }
.hint { color: #7f8c8d; font-size: 12px; margin: 10px 0 0; line-height: 1.6; }
.hint code { background: #ecf0f1; padding: 1px 5px; border-radius: 3px; color: #c0392b; }
.root-tag { color: #2471a3; font-style: italic; }
.no-domain { color: #95a5a6; font-style: italic; font-size: 12px; }
.list-head { display: flex; align-items: center; justify-content: space-between; }
.list-head h2 { margin: 0; }
.toggle { font-size: 13px; color: #7f8c8d; display: flex; align-items: center; gap: 5px; cursor: pointer; }
.row-hidden { opacity: 0.45; }
.alive-badge { display: inline-block; padding: 0 5px; border-radius: 3px; background: #eafaf1; color: #1e8449; font-size: 11px; border: 1px solid #a9dfbf; }
.domain-cell { font-family: monospace; color: #34495e; }
.path-cell { font-family: monospace; }
.conf-title { font-size: 14px; color: #34495e; margin: 16px 0 6px; }
.conf-name { font-family: monospace; font-size: 12px; color: #95a5a6; font-weight: normal; }
input {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}
input:focus { outline: none; border-color: #3498db; }
button {
  padding: 8px 16px;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}
button:hover { background: #2980b9; }
button.danger { background: #e74c3c; }
button.danger:hover { background: #c0392b; }
button.muted { background: #95a5a6; }
button.muted:hover { background: #7f8c8d; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid #ecf0f1;
  font-size: 14px;
}
th { background: #ecf0f1; color: #2c3e50; font-weight: 600; }
tr:hover { background: #f8f9fa; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}
.badge.active { background: #2ecc71; color: white; }
.badge.external { background: #3498db; color: white; }
.badge.stopped { background: #95a5a6; color: white; }
.kind {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.kind.http { background: #eaf4fb; color: #2471a3; border: 1px solid #aed6f1; }
.kind.tcp { background: #fdf2e9; color: #a04000; border: 1px solid #f5cba7; }
.url-cell { font-family: monospace; color: #2980b9; }
.actions { display: flex; gap: 5px; }
.actions button { padding: 4px 10px; font-size: 12px; }
pre {
  background: #2c3e50;
  color: #ecf0f1;
  padding: 15px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
  max-height: 500px;
  overflow-y: auto;
}
#toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  background: #2ecc71;
  color: white;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 1000;
}
#toast.show { opacity: 1; }
#toast.error { background: #e74c3c; }

/* 登录页 */
body.login-page {
  max-width: none;
  padding: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 380px;
}
.login-box h1 { margin: 0 0 5px; color: #2c3e50; }
.login-box .sub { color: #7f8c8d; margin-bottom: 30px; font-size: 13px; }
.login-box form { display: flex; flex-direction: column; gap: 12px; }
.login-box label { font-size: 13px; color: #555; margin-bottom: -8px; }
.login-box input { padding: 10px 12px; width: 100%; }
.login-box button { padding: 12px; margin-top: 8px; font-size: 15px; }
.login-box .err {
  color: #e74c3c;
  font-size: 13px;
  text-align: center;
  margin: 8px 0 0;
  min-height: 18px;
}

/* 编辑弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-mask[hidden] { display: none; }
.modal {
  background: #fff; border-radius: 8px; padding: 22px 24px; width: 380px;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.modal h3 { margin: 0 0 16px; font-size: 16px; color: #2c3e50; }
.modal label { display: block; margin-bottom: 11px; font-size: 13px; color: #5d6d7e; }
.modal label input[type=text], .modal label input:not([type]) {
  display: block; width: 100%; margin-top: 4px; padding: 7px 9px;
  border: 1px solid #d5dbdb; border-radius: 4px; font-size: 13px; box-sizing: border-box;
}
.modal label input[type=number] {
  display: block; width: 100%; margin-top: 4px; padding: 7px 9px;
  border: 1px solid #d5dbdb; border-radius: 4px; font-size: 13px; box-sizing: border-box;
}
.modal label.toggle { display: flex; align-items: center; gap: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
