* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  max-width: 980px; margin: 0 auto; padding: 12px;
  background: #f5f6f8; color: #222;
}
header h1 { font-size: 20px; margin: 6px 0 2px; }
header .ver { font-size: 12px; color: #888; }
header .sub { color: #666; margin: 0 0 10px; font-size: 12px; }
section {
  background: #fff; border: 1px solid #e3e5e8; border-radius: 8px;
  padding: 12px 14px; margin-bottom: 12px;
}
h2 { font-size: 15px; margin: 2px 0 10px; }
h3 { font-size: 13.5px; margin: 10px 0 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
label { font-size: 13px; color: #555; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
input[type=password], input[type=text] {
  padding: 8px 10px; border: 1px solid #ccc; border-radius: 5px;
  width: 320px; max-width: 100%; font-size: 14px;  /* ≥16px 更好，14 防 iOS 自动放大取平衡 */
}
button {
  padding: 9px 18px; border: 1px solid #2b6cb0; background: #3182ce;
  color: #fff; border-radius: 6px; cursor: pointer; font-size: 14px;
  min-height: 42px;  /* 触控目标 */
}
button:disabled { background: #b8c4d0; border-color: #b8c4d0; cursor: not-allowed; }
button.danger { background: #c53030; border-color: #c53030; }
button.danger:disabled { background: #b8c4d0; border-color: #b8c4d0; }
.status { font-size: 13px; color: #555; margin: 8px 0 0; word-break: break-all; }
.status.ok { color: #2f855a; }
.status.warn { color: #c05621; }
.status.err { color: #c53030; }
.hint { font-size: 12px; color: #888; }
.hidden { display: none; }
pre {
  background: #f8f9fa; border: 1px solid #e3e5e8; border-radius: 6px;
  padding: 10px; font-size: 12px; overflow-x: auto;
  white-space: pre-wrap; word-break: break-all;
}
#log { max-height: 300px; overflow-y: auto; }

/* 换仓表格：窄屏横向滑动 */
#trade-tables, #signals-tables { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; margin: 8px 0; }
th, td { border: 1px solid #e3e5e8; padding: 5px 8px; text-align: right; white-space: nowrap; }
th { background: #f0f2f5; }
td.l, th.l { text-align: left; }
tr.buy td { background: #f0fff4; }
tr.sell td { background: #fff5f5; }
summary { cursor: pointer; font-size: 13px; color: #2b6cb0; }

/* 顶部并排：① 策略包 ｜ ③ 交易授权 */
.top-row { display: flex; gap: 14px; align-items: stretch; }
.top-row section { flex: 1; min-width: 0; }
.v-divider { width: 1px; background: #d8dbe0; margin: 4px 0; }

/* 页头导航按钮（右上角入口） */
header { position: relative; }
.nav-btn {
  position: absolute; top: 8px; right: 0;
  width: auto; min-height: 38px; padding: 7px 16px; font-size: 13px;
}

/* ── 手机适配（≤640px：竖屏手机全宽布局） ── */
@media (max-width: 640px) {
  body { padding: 8px; }
  section { padding: 12px 12px; border-radius: 10px; }
  .top-row { flex-direction: column; gap: 0; }
  .v-divider { width: auto; height: 1px; margin: 0 4px; }
  .row { flex-direction: column; align-items: stretch; gap: 10px; }
  .row label { flex-direction: column; align-items: stretch; gap: 4px; }
  input[type=password], input[type=text] { width: 100%; font-size: 16px; }  /* iOS 防聚焦自动放大 */
  button { width: 100%; min-height: 46px; font-size: 15px; }
  .row .status { margin-top: 0; }
  pre { font-size: 11px; }
  #log { max-height: 240px; }
  table { font-size: 11.5px; }
  th, td { padding: 4px 6px; }
}

/* ── 大屏手机横屏 / 小平板（641–980px） ── */
@media (min-width: 641px) and (max-width: 980px) {
  body { padding: 12px 16px; }
  button { min-height: 44px; }
}
