/* A股共振扫描器 - 界面样式（移动端优先） */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --red: #d73838; --red-bg: #fdeeee;
  --green: #1a9c6b; --green-bg: #e8f7f0;
  --blue: #2b6cb0; --blue-bg: #eaf2fb;
  --ink: #1f2733; --ink2: #5a6472; --ink3: #9aa3af;
  --line: #e5e9ef; --bg: #f4f6f9; --card: #ffffff;
  --amber-bg: #fff7e6; --amber: #b8860b;
}
html { font-size: 15px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.5;
}

/* 头部 */
.header { background: linear-gradient(135deg, #1c2b4a 0%, #2b4370 100%); color: #fff; padding: 14px 16px 0; }
.h-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.header h1 { font-size: 1.25rem; letter-spacing: 1px; }
.badge {
  font-size: .68rem; padding: 3px 9px; background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.35); border-radius: 999px; white-space: nowrap;
  margin-left: auto;
}
.lic-chip {
  font-size: .7rem; padding: 3px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.1); color: #ffe9a8;
  white-space: nowrap;
}
.lic-chip.ok { background: rgba(46,160,67,.25); color: #b8f0c6; }
.cutoff-bar {
  margin-top: 10px; background: rgba(0,0,0,.22); border-radius: 8px 8px 0 0;
  padding: 8px 12px; font-size: .85rem; color: #ffe9a8; display: flex; gap: 8px; align-items: center;
}
.cutoff-bar.small { margin: 0 0 10px; background: var(--amber-bg); color: #8a6d1a; border-radius: 8px; font-size: .8rem; }
.cut-icon { flex: none; }

/* 主体 */
.main { max-width: 860px; margin: 0 auto; padding: 14px 12px 30px; }
.card { background: var(--card); border-radius: 12px; padding: 16px 14px; margin-bottom: 14px; box-shadow: 0 1px 4px rgba(20,40,80,.06); }
.card-title { font-size: 1rem; margin-bottom: 12px; color: var(--ink); }

/* 模式tab */
.mode-tabs { display: flex; gap: 10px; margin-bottom: 14px; }
.mode-tab {
  flex: 1; padding: 10px 8px; border-radius: 12px; border: 2px solid var(--line);
  background: #fff; cursor: pointer; font-size: .95rem; font-weight: 600; color: var(--ink2);
  transition: all .15s;
}
.mode-tab .sub { font-size: .7rem; font-weight: 400; color: var(--ink3); margin-top: 3px; }
.mode-tab.active { border-color: var(--blue); color: var(--blue); background: var(--blue-bg); }
.mode-tab.active .sub { color: var(--blue); opacity: .8; }

/* 表单 */
input, select, textarea { max-width: 100%; }
.form-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.form-row.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.form-row.three > div { min-width: 0; }
.form-row.three .inp { width: 100%; }
.lbl { font-size: .85rem; color: var(--ink2); white-space: nowrap; }
.hint { font-size: .75rem; color: var(--ink3); }
.sel, .inp {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: .88rem;
  background: #fff; color: var(--ink); outline: none; min-width: 0; max-width: 100%;
}
.sel:focus, .inp:focus { border-color: var(--blue); }
.sel.sm { padding: 6px 8px; font-size: .8rem; }
.inp.num { width: 74px; }
.ta {
  width: 100%; min-height: 64px; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: .85rem; resize: vertical; font-family: inherit;
}
.ta.code { min-height: 84px; font-family: Consolas, monospace; font-size: .75rem; word-break: break-all; }

/* 指标网格 */
.ind-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 8px; }
.ind-item {
  display: flex; align-items: flex-start; gap: 7px; border: 1.5px solid var(--line);
  border-radius: 10px; padding: 8px 10px; cursor: pointer; transition: all .12s; background: #fff;
}
.ind-item:hover { border-color: var(--blue); }
.ind-item.on { border-color: var(--blue); background: var(--blue-bg); }
.ind-item input { margin-top: 3px; flex: none; }
.ind-item .nm { font-size: .85rem; font-weight: 600; }
.ind-item .nm .hot { color: #d73838; font-size: .65rem; margin-left: 3px; }
.ind-item .ds { font-size: .68rem; color: var(--ink3); margin-top: 2px; }
.cat-tag { font-size: .62rem; padding: 1px 5px; border-radius: 4px; background: #eef1f5; color: var(--ink2); margin-left: 4px; }

/* 参数面板 */
.param-panel { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.param-group { margin-bottom: 10px; }
.param-group .pg-title { font-size: .8rem; font-weight: 600; color: var(--blue); margin-bottom: 6px; }
.param-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.param-item { display: flex; align-items: center; gap: 5px; font-size: .78rem; color: var(--ink2); }
.param-item input, .param-item select { border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; font-size: .78rem; width: 78px; }
.param-item select { width: auto; }

/* 复选 */
.chk-row { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 8px 0 12px; font-size: .85rem; color: var(--ink2); }
.chk-row label, .tf-checks label { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.tf-checks { display: flex; gap: 16px; font-size: .88rem; }
.ck-inline { font-size: .78rem; color: var(--ink2); display: flex; align-items: center; gap: 4px; white-space: nowrap; }

/* 扫描按钮 */
.scan-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn-scan {
  flex: 1; min-width: 160px; background: linear-gradient(135deg, #d73838, #b02a2a); color: #fff;
  border: none; border-radius: 10px; padding: 12px; font-size: 1.05rem; font-weight: 700;
  cursor: pointer; letter-spacing: 2px;
}
.btn-scan:active { transform: scale(.98); }
.btn-scan:disabled { background: #b9c2cf; cursor: not-allowed; }
.btn-cancel {
  background: #fff; border: 1.5px solid var(--line); color: var(--ink2); border-radius: 10px;
  padding: 12px 18px; font-size: .95rem; cursor: pointer;
}
.scan-side { display: flex; gap: 12px; align-items: center; }
.progress-wrap { margin-top: 12px; }
.progress { height: 10px; background: #edf0f4; border-radius: 999px; overflow: hidden; }
.progress-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, #2b6cb0, #4299e1); transition: width .3s;
}
.prog-text { font-size: .78rem; color: var(--ink2); margin-top: 6px; }
.esthint { font-size: .72rem; color: var(--ink3); margin-top: 6px; }

/* 结果表 */
.res-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.res-summary { font-size: .78rem; color: var(--ink2); font-weight: 400; margin-left: 6px; }
.btn-ghost {
  border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 12px;
  font-size: .8rem; cursor: pointer; color: var(--ink2);
}
.table-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid var(--line); }
.res-table { width: 100%; border-collapse: collapse; font-size: .82rem; min-width: 620px; }
.res-table th {
  background: #f4f6f9; color: var(--ink2); font-weight: 600; text-align: left;
  padding: 8px 10px; white-space: nowrap; position: sticky; top: 0;
}
.res-table td { padding: 8px 10px; border-top: 1px solid #eef1f5; vertical-align: top; }
.res-table tr.row { cursor: pointer; }
.res-table tr.row:hover { background: #f8fafd; }
.res-table tr.detail td { background: #f8fafd; }
.up { color: var(--red); font-weight: 600; }
.down { color: var(--green); font-weight: 600; }
.sig-tags { display: flex; flex-wrap: wrap; gap: 4px; max-width: 320px; }
.sig-tag {
  font-size: .68rem; padding: 2px 7px; border-radius: 5px; background: var(--red-bg); color: var(--red);
  white-space: nowrap; border: 1px solid #f3cccc;
}
.sig-tag.tf { background: var(--blue-bg); color: var(--blue); border-color: #cfe0f3; }
.detail-box { padding: 6px 4px 10px; }
.detail-box .d-row { margin: 4px 0; font-size: .78rem; color: var(--ink2); }
.detail-box .d-row b { color: var(--ink); }
.mini-bars { display: flex; align-items: flex-end; gap: 1.5px; height: 44px; margin: 8px 0 2px; }
.mini-bar { flex: 1; min-width: 2px; border-radius: 1px; background: #dfe5ec; }
.mini-bar.up { background: #e58585; }
.mini-bar.down { background: #8fd4b6; }
.src-tag { margin-left: auto; font-size: .68rem; color: var(--ink3); }
.empty { text-align: center; color: var(--ink3); padding: 34px 10px; font-size: .9rem; }

/* 免责声明 & 页脚 */
.disclaimer {
  background: var(--amber-bg); border: 1px solid #f0e2bb; color: #8a6d1a;
  border-radius: 10px; padding: 12px 14px; font-size: .75rem; margin-bottom: 16px; line-height: 1.7;
}
.footer { text-align: center; color: var(--ink3); font-size: .72rem; line-height: 1.9; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: #fff; border-radius: 14px; padding: 20px 16px; width: 100%; max-width: 440px;
  max-height: 86vh; overflow-y: auto;
}
.modal h3 { font-size: 1.05rem; margin-bottom: 12px; }
.lic-state { background: #f4f6f9; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: .85rem; }
.lic-state .mcode {
  font-family: Consolas, monospace; font-size: .8rem; background: #fff; border: 1px dashed var(--line);
  border-radius: 6px; padding: 6px 8px; margin-top: 6px; word-break: break-all; cursor: pointer;
}
.lic-btns { display: flex; gap: 10px; margin-top: 10px; }
.lic-btns .btn-scan { flex: 1; min-width: 0; padding: 10px; }
.lic-err { color: var(--red); font-size: .78rem; margin-top: 8px; min-height: 1em; }
.howto { font-size: .72rem; color: var(--ink3); margin-top: 12px; line-height: 1.6; }
.lic-form { margin-top: 4px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: rgba(20,30,50,.88); color: #fff; border-radius: 999px; padding: 9px 20px;
  font-size: .82rem; z-index: 200; max-width: 86vw; text-align: center;
}

/* 响应式 */
@media (min-width: 640px) {
  .ind-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .form-row.three { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 420px) {
  html { font-size: 14px; }
  .form-row.three { grid-template-columns: 1fr 1fr 1fr; }
  .sig-tags { max-width: 200px; }
}
