:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #1a1a1a;
  --sub: #6b7280;
  --line: #e5e7eb;
  --brand: #1a73e8;
  --brand-d: #155ec0;
  --ok: #1a8a3c;
  --err: #d23b3b;
  --warn: #b7791f;
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 18px; }
.brand .ver {
  font-size: 11px; font-weight: 600; color: #fff; background: var(--brand);
  border-radius: 6px; padding: 2px 7px; margin-left: 6px; vertical-align: middle;
}
.dbg-toggle {
  font-size: 13px; color: var(--sub); background: #fff;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer;
}

#app { padding: 16px; max-width: 720px; margin: 0 auto; }

/* 横幅 */
.hero {
  background: linear-gradient(135deg, #1a73e8, #34a0ff);
  color: #fff; border-radius: 20px; padding: 22px 20px; margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(26,115,232,.18);
}
.hero h1 { margin: 0 0 4px; font-size: 22px; }
.hero .sub { opacity: .9; font-size: 13px; }
.hero .state { display: inline-block; margin-top: 10px; font-size: 12px;
  background: rgba(255,255,255,.22); border-radius: 999px; padding: 4px 12px; }
.hero .state.bad { background: rgba(210,59,59,.85); }
.hero .state.good { background: rgba(26,138,60,.85); }

/* 卡片 */
.card {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  margin-bottom: 18px; box-shadow: 0 2px 12px rgba(0,0,0,.04);
}
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; }

/* 功能导航 */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.act {
  border: none; border-radius: 14px; padding: 22px 10px; color: #fff;
  font-size: 16px; font-weight: 600; text-align: center; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
}
.act:active { filter: brightness(.95); }
.act-1 { background: #1a73e8; }
.act-2 { background: #0aa06e; }
.act-3 { background: #b7791f; }
.act-4 { background: #d23b3b; }

/* 行 */
.row { display: flex; justify-content: space-between; gap: 16px;
  padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.row:last-child { border-bottom: none; }
.row-label { color: var(--sub); flex: 0 0 auto; }
.row-value { text-align: right; word-break: break-all; }
.row-value.sensitive { color: var(--warn); }

/* 表单 */
.field { margin-bottom: 14px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--sub); margin: 4px 0 14px; cursor: pointer; }
.chk input { width: 16px; height: 16px; }
.field label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 5px; }
.field input[type=text], .field input[type=datetime-local], .field select {
  width: 100%; padding: 11px 12px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
.field input.pwd { letter-spacing: 2px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0; font-size: 14px; }
.toggle-row .desc { color: var(--sub); font-size: 12px; }
.switch { position: relative; width: 46px; height: 26px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #ccc; border-radius: 999px; transition: .2s; cursor: pointer; }
.slider:before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* 按钮 */
.btn {
  display: block; width: 100%; margin-top: 10px; padding: 13px;
  font-size: 16px; font-weight: 600; color: #fff; background: var(--brand);
  border: none; border-radius: 12px; cursor: pointer;
}
.btn:active { background: var(--brand-d); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.sec { background: #6b7280; }
.btn.danger { background: var(--err); }

/* 进度 */
.progress { height: 14px; background: #eef1f6; border-radius: 999px; overflow: hidden; margin: 12px 0; }
.progress > i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .15s; }

/* 原始 JSON / 代码 */
.raw { margin-top: 10px; background: #1e1e1e; color: #b5e853; border-radius: 10px;
  padding: 10px; font-family: Menlo, Consolas, monospace; font-size: 12px;
  white-space: pre-wrap; word-break: break-all; max-height: 220px; overflow: auto; }
.pre { white-space: pre-wrap; word-break: break-all; font-family: Menlo, Consolas, monospace;
  font-size: 12px; background: #0f172a; color: #cbd5e1; border-radius: 10px; padding: 10px;
  max-height: 260px; overflow: auto; }
.mono { font-family: Menlo, Consolas, monospace; }

/* 状态文本 */
.ok { color: var(--ok); }
.err { color: var(--err); }
.muted { color: var(--sub); font-size: 13px; }
/* 配置下发结果大号横幅（只显示成功/失败） */
.ok.big, .err.big { font-size: 18px; font-weight: 700; padding: 12px 14px; border-radius: 10px; margin: 6px 0 2px; text-align: center; }
.ok.big { color: #0a7d32; background: #e7f7ec; border: 1px solid #aee3bf; }
.err.big { color: #c0392b; background: #fdecea; border: 1px solid #f5b5ad; }
.center { text-align: center; }
.notice { background: #fff8e6; border: 1px solid #ffe08a; color: #8a6d1a;
  border-radius: 10px; padding: 11px; font-size: 13px; margin-top: 10px; }

/* 记录列表 */
.rec { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 9px; }
.rec-head { font-weight: 600; margin-bottom: 5px; }
.rec .row { font-size: 13px; }

/* 调试面板 */
.debug {
  position: fixed; left: 0; right: 0; bottom: 0; max-height: 42vh;
  background: #0c0f16; border-top: 2px solid #1f2937; z-index: 50;
  display: flex; flex-direction: column;
}
.debug.hidden { display: none; }
.debug-head { color: #93a4bd; font-size: 12px; padding: 8px 14px; border-bottom: 1px solid #1f2937; }
.debug-log { overflow: auto; padding: 6px 14px; font-family: Menlo, Consolas, monospace; font-size: 11px; }
.dbg-line { white-space: pre-wrap; word-break: break-all; padding: 2px 0; }
.dbg-tx { color: #7fd1ff; }
.dbg-rx { color: #b5e853; }
.dbg-line.dbg-info { color: #93a4bd; }

.hidden { display: none !important; }

.dbg-ver { color: #6b7c93; font-size: 11px; margin-left: 8px; }

/* 版本戳（确认线上是否为最新构建） */
.footer {
  margin-top: 24px;
  padding: 10px 16px;
  text-align: center;
  font-size: 12px;
  color: #9aa0a6;
  border-top: 1px solid #eee;
}
