:root {
  --bh-primary: #1890ff;
  --bh-primary-hover: #40a9ff;
  --bh-text: rgba(0,0,0,.85);
  --bh-secondary: rgba(0,0,0,.65);
  --bh-border: #d9d9d9;
  --bh-bg: #f0f2f5;
  --bh-danger: #ff4d4f;
  --bh-label-w: 168px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--bh-text);
  background: #fff;
  line-height: 1.5715;
}

/* —— 首页/运维台保留简易样式 —— */
.page:not(.bh-edit) {
  max-width: 960px; margin: 24px auto; padding: 24px;
  background: #fff; border-radius: 8px;
}
.ok-box, .err-box { padding: 12px 16px; border-radius: 6px; margin: 12px 0; }
.ok-box { background: #f6ffed; border: 1px solid #b7eb8f; color: #389e0d; }
.err-box { background: #fff2f0; border: 1px solid #ffccc7; color: #cf1322; }
.hint { color: var(--bh-secondary); font-size: 13px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 32px; padding: 0 15px; border-radius: 2px; border: 1px solid var(--bh-border);
  background: #fff; color: var(--bh-text); cursor: pointer; font-size: 14px;
}
.btn-primary { background: var(--bh-primary); border-color: var(--bh-primary); color: #fff; }
.btn-primary:hover { background: var(--bh-primary-hover); border-color: var(--bh-primary-hover); }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; margin-bottom: 6px; }
input, select, textarea {
  width: 100%; height: 32px; padding: 4px 11px; border: 1px solid var(--bh-border);
  border-radius: 2px; font: inherit; outline: none; background: #fff;
}
textarea { height: auto; min-height: 80px; padding: 8px 11px; }
input:focus, select:focus, textarea:focus { border-color: var(--bh-primary); box-shadow: 0 0 0 2px rgba(24,144,255,.2); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 6px; }
.submit-wrap { margin-top: 20px; }
.hidden { display: none !important; }

/* —— BotHub 同款管理页 —— */
.bh-edit {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 28px 56px;
  background: #fff;
  min-height: 100vh;
  box-shadow: 0 0 0 1px rgba(0,0,0,.02);
}
.bh-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.bh-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--bh-text);
  letter-spacing: .2px;
}
.bh-tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f0f0f0;
  margin: 8px 0 28px;
}
.bh-tabs { display: flex; gap: 0; }
.bh-tab {
  position: relative;
  border: 0;
  background: transparent;
  padding: 12px 16px;
  margin: 0;
  cursor: pointer;
  color: var(--bh-secondary);
  font-size: 14px;
}
.bh-tab.active {
  color: var(--bh-primary);
  font-weight: 500;
}
.bh-tab.active::after {
  content: "";
  position: absolute;
  left: 16px; right: 16px; bottom: -1px;
  height: 2px;
  background: var(--bh-primary);
}
.bh-panel { display: none; }
.bh-panel.active { display: block; }

.bh-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 22px;
  min-height: 32px;
}
.bh-item.center { align-items: center; }
.bh-label {
  flex: 0 0 var(--bh-label-w);
  width: var(--bh-label-w);
  text-align: right;
  padding: 5px 12px 0 0;
  color: var(--bh-text);
  line-height: 22px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.bh-label .colon { margin-left: 2px; }
.bh-req {
  color: var(--bh-danger);
  font-family: SimSun, sans-serif;
  margin-right: 2px;
}
.bh-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(0,0,0,.35);
  border-radius: 50%;
  color: rgba(0,0,0,.45);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: help;
  flex: 0 0 14px;
  margin-top: 4px;
  user-select: none;
  background: #fff;
  transition: color .15s, border-color .15s;
}
.bh-tip:hover { color: var(--bh-primary); border-color: var(--bh-primary); }
.bh-tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  background: rgba(0,0,0,.88);
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.55;
  padding: 8px 10px;
  border-radius: 6px;
  white-space: pre-wrap;
  width: max-content;
  max-width: 300px;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  z-index: 30;
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
}
.bh-tip::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(0,0,0,.88);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
}
.bh-tip:hover::after,
.bh-tip:hover::before,
.bh-tip:focus::after,
.bh-tip:focus::before { opacity: 1; }

.bh-control {
  flex: 1;
  min-width: 0;
  max-width: 720px;
}
.bh-control > .bh-input,
.bh-control > .bh-select,
.bh-control > .bh-textarea {
  width: 100%;
}
.bh-input, .bh-select, .bh-textarea {
  height: 32px;
  padding: 4px 11px;
  border: 1px solid var(--bh-border);
  border-radius: 6px;
  font: inherit;
  outline: none;
  background: #fff;
  color: var(--bh-text);
  transition: all .2s;
}
.bh-textarea { height: auto; min-height: 96px; padding: 8px 11px; resize: vertical; }
.bh-input:hover, .bh-select:hover, .bh-textarea:hover { border-color: var(--bh-primary-hover); }
.bh-input:focus, .bh-select:focus, .bh-textarea:focus {
  border-color: var(--bh-primary);
  box-shadow: 0 0 0 2px rgba(24,144,255,.2);
}
.bh-input::placeholder, .bh-textarea::placeholder { color: #bfbfbf; }
.bh-control .hint {
  margin-top: 6px;
  color: #8c8c8c;
  font-size: 12px;
  line-height: 1.5;
}

.bh-media {
  display: flex;
  gap: 8px;
  align-items: center;
}
.bh-media .bh-select { width: 110px; flex: 0 0 110px; }
.bh-media .bh-input { flex: 1; }

.bh-radios, .bh-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  padding-top: 5px;
}
.bh-radio, .bh-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--bh-text);
  line-height: 22px;
}
.bh-radio input, .bh-check input {
  width: 16px; height: 16px; margin: 0; accent-color: var(--bh-primary);
}

.bh-editor {
  border: 1px solid var(--bh-border);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}
.bh-editor:focus-within { border-color: var(--bh-primary); box-shadow: 0 0 0 2px rgba(24,144,255,.15); }
.bh-editor-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
}
.bh-editor-bar button {
  width: 28px; height: 28px; border: 0; background: transparent;
  border-radius: 2px; cursor: pointer; color: rgba(0,0,0,.65); font-size: 13px;
}
.bh-editor-bar button:hover { background: #e6f7ff; color: var(--bh-primary); }
.bh-editor-body {
  min-height: 120px;
  padding: 10px 12px;
  outline: none;
  line-height: 1.6;
}
.bh-editor-body:empty:before {
  content: attr(data-placeholder);
  color: #bfbfbf;
  pointer-events: none;
}

.bh-inline-2 {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  width: 100%;
}
.bh-inline-2 .bh-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 260px;
}
.bh-inline-2 .bh-sub > span {
  white-space: nowrap;
  color: var(--bh-text);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.bh-inline-2 .bh-input { width: 140px; flex: 0 0 140px; }
.bh-unit { color: var(--bh-secondary); }

.bh-channel-list { margin-top: 8px; }
.bh-channel-list .bh-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f5f5f5;
  border: 1px solid #f0f0f0;
  border-radius: 2px;
  padding: 4px 8px;
  margin: 0 8px 8px 0;
  font-size: 13px;
}
.bh-channel-list .bh-tag button {
  border: 0; background: transparent; color: #999; cursor: pointer; padding: 0;
}

.bh-table-wrap {
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.bh-table {
  width: 100%;
  border-collapse: collapse;
}
.bh-table th, .bh-table td {
  border-bottom: 1px solid #f0f0f0;
  padding: 13px 16px;
  text-align: left;
  font-size: 14px;
  line-height: 1.5;
}
.bh-table tr:last-child td { border-bottom: 0; }
.bh-table th {
  background: #fafafa;
  font-weight: 500;
  color: rgba(0,0,0,.88);
  white-space: nowrap;
}
.bh-table tbody tr:hover td { background: #fafafa; }
.bh-table .link {
  border: 0; background: transparent; color: var(--bh-danger); cursor: pointer; padding: 0;
  font-size: 14px;
}
.bh-table .link:hover { color: #ff7875; }
.bh-empty {
  text-align: center;
  color: rgba(0,0,0,.25);
  padding: 48px 16px !important;
  font-size: 14px;
}
.bh-status {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  background: #e6f4ff;
  color: #1677ff;
}
.bh-prize-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.bh-prize-head .bh-subhint { color: rgba(0,0,0,.45); font-size: 13px; }

.bh-submit {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 36px;
  padding: 20px 0 8px;
  border-top: 1px solid #f0f0f0;
}
.bh-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 32px; padding: 0 15px; border-radius: 6px;
  border: 1px solid var(--bh-border); background: #fff;
  color: var(--bh-text); cursor: pointer; font-size: 14px;
  white-space: nowrap;
  transition: all .2s;
  line-height: 1;
}
.bh-btn:hover { color: var(--bh-primary); border-color: var(--bh-primary); }
.bh-btn-primary {
  background: var(--bh-primary); border-color: var(--bh-primary); color: #fff;
}
.bh-btn-primary:hover { background: var(--bh-primary-hover); border-color: var(--bh-primary-hover); color: #fff; }
.bh-btn-danger { color: var(--bh-danger); border-color: #ffccc7; }
.bh-btn-danger:hover { color: #fff; background: var(--bh-danger); border-color: var(--bh-danger); }
.bh-btn-lg { height: 40px; padding: 0 28px; font-size: 15px; font-weight: 500; border-radius: 6px; }

.bh-badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: 4px; font-size: 12px; margin-left: 8px; vertical-align: middle;
}
.bh-badge-draft { background: #fff7e6; color: #d46b08; }
.bh-badge-active { background: #f6ffed; color: #389e0d; }
.bh-badge-done { background: #f5f5f5; color: #8c8c8c; }

/* modal */
.bh-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45); padding: 16px;
}
.bh-modal-card {
  background: #fff;
  border-radius: 8px;
  width: min(520px, 100%);
  box-shadow: 0 6px 16px 0 rgba(0,0,0,.08), 0 3px 6px -4px rgba(0,0,0,.12), 0 9px 28px 8px rgba(0,0,0,.05);
  padding: 20px 24px;
  animation: bhPop .16s ease-out;
}
@keyframes bhPop {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: 1; transform: scale(1); }
}
.bh-modal-card.wide {
  width: min(920px, 100%);
  max-height: 82vh;
  overflow: auto;
  padding: 16px 24px 24px;
}
.bh-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}
.bh-modal-head h3 {
  margin: 0; font-size: 16px; font-weight: 600; color: rgba(0,0,0,.88);
}
.bh-modal-x {
  border: 0; background: transparent; font-size: 16px; color: rgba(0,0,0,.45);
  cursor: pointer; line-height: 1; padding: 4px 6px; border-radius: 4px;
}
.bh-modal-x:hover { color: rgba(0,0,0,.88); background: rgba(0,0,0,.04); }
.bh-modal-foot {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px;
}
.bh-modal-item {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.bh-modal-item .bh-label-inline {
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 4px;
  min-width: 110px;
  justify-content: flex-end;
  color: rgba(0,0,0,.88);
}
.bh-modal-item .bh-input { flex: 1; }

.bh-search-bar {
  display: flex; gap: 12px; margin-bottom: 16px; align-items: center;
}
.bh-search-bar .bh-select {
  width: 128px; flex: 0 0 128px; border-radius: 6px;
}
.bh-search-wrap {
  display: flex; flex: 1; min-width: 0; align-items: stretch;
}
.bh-search-wrap .bh-input {
  border-radius: 6px 0 0 6px;
  border-right: 0;
  flex: 1;
  min-width: 0;
}
.bh-search-wrap .bh-input:focus {
  position: relative;
  z-index: 1;
}
.bh-search-wrap .bh-btn-search {
  flex: 0 0 auto;
  min-width: 64px;
  height: 32px;
  padding: 0 16px;
  border-radius: 0 6px 6px 0;
  background: var(--bh-primary);
  border: 1px solid var(--bh-primary);
  color: #fff;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  line-height: 32px;
}
.bh-search-wrap .bh-btn-search:hover {
  background: var(--bh-primary-hover);
  border-color: var(--bh-primary-hover);
}

.bh-channel-list .bh-tag {
  border-radius: 6px;
  background: #f5f5f5;
  border: 1px solid #f0f0f0;
  transition: all .15s;
}
.bh-channel-list .bh-tag:hover { border-color: #d9d9d9; }
.bh-channel-list .bh-tag button:hover { color: var(--bh-danger); }

@media (max-width: 768px) {
  .bh-edit { padding: 12px; }
  .bh-item { flex-direction: column; }
  .bh-label {
    width: 100%; flex: none; text-align: left; justify-content: flex-start; padding: 0 0 8px;
    white-space: normal;
  }
  :root { --bh-label-w: auto; }
  .bh-search-bar { flex-wrap: wrap; }
  .bh-search-bar .bh-select { width: 100%; flex: 1 1 100%; }
  .bh-modal-item { flex-direction: column; align-items: stretch; }
  .bh-modal-item .bh-label-inline { justify-content: flex-start; min-width: 0; }
}
