* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --text: #1A1D24;
  --text-2: #5E6472;
  --text-3: #969CA8;
  --border: #E6E9EF;
  --blue: #2E6FE8;
  --blue-soft: #EAF1FE;
  --green: #1D9E75;
  --red: #D64545;
  --amber: #C8871A;
  --radius: 14px;
}

html, body {
  /* 手机端只保留上下滚动，禁止浏览器双指缩放与双击缩放 */
  touch-action: pan-y;
  -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 40px 36px 32px;
  text-align: center;
}
.login-brand {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--blue);
  margin-bottom: 16px;
}
.login-title { font-size: 22px; font-weight: 600; margin-bottom: 8px; }
.login-sub { font-size: 13px; color: var(--text-2); margin-bottom: 28px; }
.login-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  margin-bottom: 14px;
  transition: border-color .2s;
}
.login-card input:focus { border-color: var(--blue); }
.login-card button {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .2s;
}
.login-card button:hover { opacity: .9; }
.login-err { color: var(--red); font-size: 12px; min-height: 18px; margin-top: 10px; }
.login-note { font-size: 11px; color: var(--text-3); margin-top: 20px; }

/* ---------- 版面 ---------- */
.dashboard { min-height: 100vh; }
.topbar {
  height: 68px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand-block { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 600;
}
.brand-name { font-size: 15px; font-weight: 600; }
.brand-sub { font-size: 11px; color: var(--text-3); }
.top-right { display: flex; align-items: center; gap: 16px; }
.status-chip {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--text-2);
  background: #F2F8F5;
  padding: 6px 12px;
  border-radius: 20px;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.logout-btn {
  font-size: 12px; color: var(--text-2);
  background: none; border: 1px solid var(--border);
  padding: 6px 14px; border-radius: 8px; cursor: pointer;
}
.logout-btn:hover { background: var(--bg); }

.content { max-width: 1280px; margin: 0 auto; padding: 28px 32px 48px; }

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 16px; font-weight: 600; }
.section-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.section-hint { font-size: 11px; color: var(--text-3); }
.slot-hint {
  display: grid;
  grid-template-columns: repeat(5, auto);
  column-gap: 8px;
  row-gap: 2px;
  text-align: right;
  align-self: flex-end;
  font-variant-numeric: tabular-nums;
}

/* ---------- 信号卡片 ---------- */
.signal-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.signal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform .15s, box-shadow .15s;
}
.signal-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(20,30,60,.06); }
.sig-label { font-size: 11px; color: var(--text-3); line-height: 1.4; }
.sig-label b { color: var(--text-2); font-weight: 600; }
.sig-value { font-size: 19px; font-weight: 600; letter-spacing: .3px; }
.sig-value.up { color: var(--red); }
.sig-value.down { color: var(--green); }
.sig-value.neutral { color: var(--text); }
.sig-code {
  font-size: 10px; color: var(--text-3);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

/* ---------- 图表卡 ---------- */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px 16px;
  margin-bottom: 20px;
}
.chart-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 12px; gap: 16px; flex-wrap: wrap;
}
.chart-title { font-size: 15px; font-weight: 600; }
.chart-sub { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.range-group { display: flex; gap: 6px; }
.range-btn {
  font-size: 11px;
  padding: 5px 12px;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 7px;
  cursor: pointer;
  transition: all .15s;
}
.range-btn:hover { border-color: var(--blue); color: var(--blue); }
.range-btn.active { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); font-weight: 500; }
.chart-main { height: 380px; width: 100%; }
.chart-z { height: 300px; width: 100%; }

.legend-band { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.legend-item {
  font-size: 10px; padding: 3px 9px; border-radius: 5px; color: #fff;
  white-space: nowrap;
}

/* ---------- 明细抽屉 ---------- */
.detail-section { margin-top: 20px; }
.detail-toggle {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 20px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  text-align: left;
}
.detail-toggle:hover { background: #FBFCFE; }
.detail-arrow { transition: transform .2s; display: inline-block; font-size: 12px; }
.detail-toggle.open .detail-arrow { transform: rotate(90deg); }
.detail-note { margin-left: auto; font-size: 11px; color: var(--text-3); font-weight: 400; }
.detail-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 12px 12px;
  margin-top: -4px;
  padding: 4px 20px 16px;
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.detail-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.detail-table th {
  text-align: center; padding: 8px 6px;
  color: var(--text-3); font-weight: 500;
  border-bottom: 1px solid var(--border);
  white-space: nowrap; line-height: 1.3;
}
.detail-table td {
  padding: 7px 6px; border-bottom: 1px solid #F2F4F7;
  white-space: nowrap; text-align: center;
}
.detail-table th:first-child, .detail-table td.dt { text-align: left; padding-left: 2px; }
.detail-table tr:last-child td { border-bottom: none; }
.detail-table td.num { font-variant-numeric: tabular-nums; }
.detail-table td.up { color: var(--red); }
.detail-table td.down { color: var(--green); }

.footer {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-3);
  margin-top: 28px; padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ---------- 数据工具（页面底部） ---------- */
.tool-section { margin-top: 20px; }
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.tool-title { font-size: 13px; font-weight: 600; color: var(--text); }
.tool-sub { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.tool-actions { display: flex; gap: 10px; flex-shrink: 0; }
.tool-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 116px; padding: 9px 18px;
  font-size: 12px; line-height: 1;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text-2);
  text-decoration: none; cursor: pointer;
  transition: background .2s, opacity .2s;
}
.tool-btn:hover { background: var(--bg); }
.tool-btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.tool-btn.primary:hover { opacity: .9; }

/* ---------- 修改口令弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 24, 32, .45);
  display: flex; align-items: center; justify-content: center;
}
.modal-card {
  width: 360px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 26px 28px;
  box-shadow: 0 18px 48px rgba(20, 24, 32, .18);
}
.modal-title { font-size: 17px; font-weight: 600; }
.modal-sub { font-size: 12px; color: var(--text-3); margin-top: 6px; margin-bottom: 18px; }
.modal-label { display: block; font-size: 12px; color: var(--text-2); margin: 14px 0 6px; }
.modal-card input {
  width: 100%; box-sizing: border-box;
  padding: 10px 12px; font-size: 13px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  outline: none;
}
.modal-card input:focus { border-color: var(--primary, #2E6FE8); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.modal-btn { padding: 9px 18px; font-size: 13px; border-radius: 8px; cursor: pointer; border: 1px solid var(--border); }
.modal-btn.ghost { background: transparent; color: var(--text-2); }
.modal-btn.primary { background: #2E6FE8; color: #fff; border-color: #2E6FE8; }

/* 口令输入框：常驻显示/隐藏切换 */
.pwd-field { position: relative; width: 100%; }
.pwd-field input { padding-right: 62px; box-sizing: border-box; margin-bottom: 0; }
.login-card .pwd-field { margin-bottom: 14px; }
.login-card .pwd-eye,
.modal-card .pwd-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  padding: 5px 7px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  opacity: 1;
}
.login-card .pwd-eye:hover,
.modal-card .pwd-eye:hover { background: rgba(46, 111, 232, .08); opacity: 1; }

@media (max-width: 1100px) {
  .signal-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .content { padding: 16px 10px 32px; }
  .topbar { padding: 0 12px; }
  .brand-sub { display: none; }
  .status-chip { padding: 5px 9px; font-size: 11px; }
  .logout-btn { padding: 5px 9px; }
  .top-right { gap: 8px; }
  .signal-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .signal-card { padding: 11px 9px; min-height: 78px; }
  .sig-label { font-size: 10px; }
  .slot-hint { font-size: 9px; column-gap: 5px; row-gap: 1px; line-height: 1.2; max-width: none; }
  .sig-value { font-size: 16px; }
  .chart-card { padding: 16px 10px 10px; }
  .chart-main { height: 280px; }
  .chart-z { height: 240px; }
  .chart-head { margin-bottom: 8px; }
  .range-group { width: 100%; gap: 4px; }
  .range-btn { flex: 1; min-width: 0; padding: 5px 2px; font-size: 10px; }
  .legend-item { font-size: 9px; padding: 2px 6px; }
  .detail-toggle { padding: 12px 12px; }
  .detail-body { padding: 4px 8px 12px; }
  .detail-table { font-size: 10px; }
  .detail-table th, .detail-table td { padding: 6px 5px; }
  .tool-card { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 12px; }
  .tool-actions { width: 100%; }
  .tool-btn { flex: 1; min-width: 0; padding: 10px 8px; }
}
