:root {
  --bg: #0b0f14;
  --bg2: #111823;
  --card: #151d29;
  --card2: #1a2432;
  --line: #23303f;
  --txt: #e6edf5;
  --dim: #8b9bab;
  --acc: #f0b90b;
  --acc2: #f8d33a;
  --ok: #28c76f;
  --err: #ff5c5c;
  --warn: #ffab2e;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(240, 185, 11, 0.08), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(56, 132, 255, 0.07), transparent 55%),
    var(--bg);
  color: var(--txt);
  font-size: 15px;
  line-height: 1.55;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 18px 16px 60px; }

/* 顶栏 */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 6px 0 18px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--acc), #d99e00); color: #14181f; font-size: 22px; font-weight: 800;
  box-shadow: 0 6px 22px rgba(240, 185, 11, 0.28);
}
.brand h1 { font-size: 18px; margin: 0; letter-spacing: .3px; }
.brand .sub { font-size: 12px; color: var(--dim); }

.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  font-size: 12.5px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--dim); white-space: nowrap;
}
.pill.on { color: #0e141b; background: var(--ok); border-color: transparent; font-weight: 600; }
.pill.off { color: #ffd4d4; background: rgba(255, 92, 92, .14); border-color: rgba(255, 92, 92, .35); }
.pill.warn { color: #ffe1b0; background: rgba(255, 171, 46, .13); border-color: rgba(255, 171, 46, .35); }
.pill.acc { color: #171c23; background: var(--acc); border-color: transparent; font-weight: 600; }

/* 数据卡 */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.card {
  background: linear-gradient(180deg, var(--card2), var(--card));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
}
.card .k { font-size: 12.5px; color: var(--dim); }
.card .v { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: .5px; }
.card .v.small { font-size: 15px; font-weight: 600; padding-top: 8px; }
.card .m { font-size: 12px; color: var(--dim); margin-top: 2px; }

/* 按钮 */
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.btn {
  border: 1px solid var(--line); background: var(--card2); color: var(--txt);
  padding: 10px 16px; border-radius: 11px; font-size: 14px; cursor: pointer;
  transition: .15s; font-family: inherit;
}
.btn:hover { border-color: #33445a; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: linear-gradient(145deg, var(--acc), #dda700); color: #171c23; border: none; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* 面板 */
.grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 14px; margin-bottom: 16px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: 15px; margin: 0; letter-spacing: .3px; }
.hint { font-size: 12px; color: var(--dim); }

/* 发帖记录 */
.posts { max-height: 460px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.post { border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; background: var(--bg2); }
.post-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); margin-bottom: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.tag.ok { color: #b8f5d0; background: rgba(40, 199, 111, .16); border-color: rgba(40, 199, 111, .3); }
.tag.fail { color: #ffcccc; background: rgba(255, 92, 92, .14); border-color: rgba(255, 92, 92, .3); }
.tag.dry { color: #cfe2ff; background: rgba(56, 132, 255, .14); border-color: rgba(56, 132, 255, .3); }
.post-text { white-space: pre-wrap; font-size: 13.5px; color: #cbd8e6; word-break: break-word; }
.post-err { color: #ff9a9a; font-size: 12.5px; margin-top: 6px; }

/* 日志 */
.logs { max-height: 460px; overflow-y: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.2px; }
.log-line { display: flex; gap: 8px; padding: 3px 0; border-bottom: 1px dashed rgba(35, 48, 63, .55); }
.log-line .t { color: #5d6d7e; flex: 0 0 92px; white-space: nowrap; }
.log-line .m { color: #b9c8d8; word-break: break-word; }
.log-line.error .m { color: #ff9a9a; }
.log-line.warn .m { color: #ffce8a; }

/* 设置 */
.tabs { display: flex; gap: 6px; }
.tab {
  background: transparent; border: 1px solid var(--line); color: var(--dim);
  padding: 6px 13px; border-radius: 9px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.tab.active { background: var(--acc); color: #171c23; border-color: transparent; font-weight: 700; }
.tabpane { display: none; padding-top: 6px; }
.tabpane.active { display: block; }

.row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.row.wrap { gap: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 180px; min-width: 150px; }
.field.wide { flex: 1 1 100%; }
.field label { font-size: 12.5px; color: var(--dim); }
input[type="text"], input[type="number"], input[type="password"], select {
  background: var(--bg2); border: 1px solid var(--line); color: var(--txt);
  padding: 9px 11px; border-radius: 9px; font-size: 14px; font-family: inherit; width: 100%;
  transition: border-color .15s;
}
input:focus, select:focus { outline: none; border-color: var(--acc); }
input[type="range"] { width: 100%; accent-color: var(--acc); }
hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
h3 { font-size: 14px; margin: 4px 0 10px; color: #cfe0f0; }

.switch { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; color: #c7d5e3; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch span {
  width: 40px; height: 22px; border-radius: 999px; background: #2a3644; position: relative; transition: .18s; flex: none;
}
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #8b9bab; transition: .18s;
}
.switch input:checked + span { background: rgba(240, 185, 11, .92); }
.switch input:checked + span::after { left: 21px; background: #171c23; }
.switch.small { font-size: 12.5px; }
.switch.small span { width: 34px; height: 19px; }
.switch.small span::after { width: 13px; height: 13px; }
.switch.small input:checked + span::after { left: 18px; }

.tip { font-size: 12.3px; color: #7d8fa1; margin: 6px 0 0; }
.savebar { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }

/* 通知 */
.notify-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 8px; }
.notify-box { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--bg2); }
.nb-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.nb-head h3 { margin: 0; }
.nb-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; }
.status-dot { font-size: 12.3px; color: var(--dim); }
.status-dot.on { color: var(--ok); }
.status-dot.err { color: var(--err); }
.status-dot.warn { color: var(--warn); }

/* 弹窗 */
.modal { display: none; position: fixed; inset: 0; background: rgba(4, 8, 12, .78); backdrop-filter: blur(6px); z-index: 50; padding: 18px; overflow-y: auto; }
.modal.show { display: flex; align-items: flex-start; justify-content: center; }
.modal-body { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; max-width: 460px; width: 100%; margin: 40px 0; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-head h3 { margin: 0; }
.qr-wrap { background: #fff; border-radius: 12px; padding: 10px; display: grid; place-items: center; min-height: 220px; margin: 12px 0; }
.qr-wrap img { width: 100%; max-width: 380px; display: block; border-radius: 8px; }
.modal-foot { display: flex; gap: 10px; }
.modal-foot .btn { flex: 1; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: #1d2735; border: 1px solid var(--line); color: var(--txt);
  padding: 11px 18px; border-radius: 11px; font-size: 13.5px; opacity: 0; pointer-events: none;
  transition: .22s; z-index: 99; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(255, 92, 92, .5); color: #ffc9c9; }

.foot { text-align: center; color: #5f7182; font-size: 12px; margin-top: 22px; }
.empty { color: #64748b; font-size: 13px; padding: 18px 0; text-align: center; }

@media (max-width: 860px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .grid { grid-template-columns: 1fr; }
  .notify-grid { grid-template-columns: 1fr; }
  .brand h1 { font-size: 16px; }
  .card .v { font-size: 22px; }
  .wrap { padding: 12px 12px 50px; }
  .btn { padding: 9px 13px; font-size: 13.5px; }
}
