/* ==========================================================================
   面料行情观测站 · 样式
   冷色调、紧凑、可扫读；涨红跌绿（国内习惯）
   ========================================================================== */
:root {
  --navy: #1f3a5f;
  --navy-2: #2c5378;
  --ink: #1b1a17;
  --ink-2: #4a5568;
  --ink-3: #8d93a0;
  --line: #e4e8ee;
  --line-2: #eef1f5;
  --bg: #f5f7fa;
  --card: #ffffff;
  --up: #c0392b;
  --down: #1e8449;
  --flat: #8d93a0;
  --amber: #c8892b;
  --accent: #1f3a5f;
  --shadow: 0 1px 2px rgba(24, 41, 66, .05), 0 4px 14px -8px rgba(24, 41, 66, .14);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Source Han Sans CN", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 20px 56px; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px 0 14px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.mark {
  width: 38px; height: 38px; border-radius: 10px; background: var(--navy);
  display: grid; place-items: center; flex: none;
}
.brandText h1 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.brandText p { margin: 2px 0 0; font-size: 11.5px; color: var(--ink-3); }

.tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--ink-3); padding: 5px 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
}
.status i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); display: block; }
.status.live i { background: var(--down); box-shadow: 0 0 0 3px rgba(30,132,73,.14); }
.status.snap i { background: var(--amber); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; font-size: 12px; font-family: inherit;
  color: var(--ink-2); background: #fff; border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer; transition: .15s;
}
.btn:hover { border-color: #c9d2de; color: var(--navy); background: #fbfcfe; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: #17304f; color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 总览 ---------- */
.overview {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; margin-bottom: 16px;
}
.ov {
  background: #fff; padding: 12px 16px;
}
.ov span { display: block; font-size: 11px; color: var(--ink-3); margin-bottom: 3px; }
.ov strong { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.ov em { font-style: normal; font-size: 11px; color: var(--ink-3); margin-left: 5px; }

/* ---------- 通用 panel ---------- */
.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; margin-bottom: 16px; box-shadow: var(--shadow);
  overflow: hidden;
}
.panelHead {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; padding: 14px 18px 10px; border-bottom: 1px solid var(--line-2);
  flex-wrap: wrap;
}
.panelHead h2 { margin: 0; font-size: 14px; font-weight: 700; }
.panelHead .sub { margin: 3px 0 0; font-size: 11.5px; color: var(--ink-3); }
.tagChip {
  display: inline-block; padding: 2px 8px; border-radius: 5px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .4px;
  background: #eef2f7; color: var(--navy-2); font-family: ui-monospace, monospace;
}
.panelBody { padding: 14px 18px 16px; }

/* ---------- 品种卡 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); gap: 10px; }
.card {
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px 10px;
  background: #fff; cursor: pointer; transition: .15s; position: relative;
}
.card:hover { border-color: #c2cede; box-shadow: 0 3px 12px -6px rgba(24,41,66,.22); }
.card.on { border-color: var(--navy); box-shadow: 0 0 0 1px var(--navy) inset; }
.cardHead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cardName { font-size: 12.5px; font-weight: 600; }
.cardNote { font-size: 10.5px; color: var(--ink-3); margin-top: 1px; line-height: 1.35; min-height: 14px; }
.cardPrice {
  display: flex; align-items: baseline; gap: 6px; margin: 7px 0 2px;
  font-variant-numeric: tabular-nums;
}
.cardPrice b { font-size: 20px; font-weight: 700; letter-spacing: -.5px; }
.cardPrice small { font-size: 10.5px; color: var(--ink-3); }
.chg { font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chg.up { color: var(--up); }
.chg.down { color: var(--down); }
.chg.flat { color: var(--flat); }

/* 三月区间带 */
.band { margin-top: 8px; }
.bandTrack {
  position: relative; height: 5px; border-radius: 3px;
  background: linear-gradient(90deg, #e8f2ec 0%, #f1f3f6 50%, #f8eae7 100%);
}
.bandFill { position: absolute; inset: 0; border-radius: 3px; background: #dde4ec; opacity: .55; }
.bandDot {
  position: absolute; top: 50%; width: 8px; height: 8px; border-radius: 50%;
  transform: translate(-50%, -50%); background: var(--navy);
  border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(31,58,95,.25);
}
.bandMeta {
  display: flex; justify-content: space-between; margin-top: 3px;
  font-size: 9.5px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.cardFoot {
  display: flex; justify-content: space-between; gap: 6px;
  margin-top: 7px; padding-top: 7px; border-top: 1px dashed var(--line-2);
  font-size: 10.5px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.posChip {
  padding: 0 5px; border-radius: 4px; font-size: 10px;
  background: #eef2f7; color: var(--navy-2);
}
.posChip.hot { background: #fbeae7; color: #a3372a; }
.posChip.cold { background: #e9f4ee; color: #1c6b40; }

/* 迷你走势 */
.spark { display: block; width: 100%; height: 30px; margin-top: 6px; }

/* ---------- 涨跌榜 ---------- */
.moverGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.moverList { list-style: none; margin: 0; padding: 0; }
.moverList li {
  display: grid; grid-template-columns: 1fr auto auto; gap: 10px;
  align-items: baseline; padding: 5px 0; border-bottom: 1px dashed var(--line-2);
  font-size: 12px;
}
.moverList li:last-child { border-bottom: 0; }
.moverList .mName { font-weight: 500; }
.moverList .mCat { font-size: 10px; color: var(--ink-3); margin-left: 5px; }
.moverList .mPrice { color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.moverList .mChg { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }

/* ---------- 走势对比 ---------- */
.chartWrap { position: relative; }
.chartSvg { display: block; width: 100%; height: 300px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.legend button {
  font-family: inherit; font-size: 11px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.legend button i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.legend button.on { border-color: currentColor; background: #fbfcfe; font-weight: 600; }
.legend button:not(.on) i { opacity: .3; }
.axisNote { font-size: 10.5px; color: var(--ink-3); margin-top: 6px; }

/* ---------- 表 ---------- */
.tblWrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 860px; }
table.tbl th {
  text-align: left; font-weight: 600; font-size: 10.5px; color: var(--ink-3);
  padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
  background: #fbfcfe;
}
table.tbl th.num, table.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: #fbfcfe; }
table.tbl .nameCell { font-weight: 600; }
table.tbl .catCell { font-size: 10.5px; color: var(--ink-3); }

/* ---------- 填报表单 ---------- */
.formGrid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; align-items: end;
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 10.5px; color: var(--ink-3); font-weight: 500; }
.field input, .field select, .field textarea {
  font-family: inherit; font-size: 12px; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 7px; background: #fff;
  color: var(--ink); width: 100%; outline: none; transition: .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(44,83,120,.08);
}
.field.span2 { grid-column: span 2; }
.formActions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.hint { font-size: 10.5px; color: var(--ink-3); margin-top: 8px; line-height: 1.6; }
.recEmpty { padding: 18px 0; text-align: center; color: var(--ink-3); font-size: 12px; }

/* ---------- 导出 ---------- */
.expGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.expCard {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 13px;
  background: #fff; text-align: left; cursor: pointer; font-family: inherit;
  transition: .15s;
}
.expCard:hover { border-color: #c2cede; background: #fbfcfe; }
.expCard b { display: block; font-size: 12.5px; margin-bottom: 3px; color: var(--ink); }
.expCard span { font-size: 10.5px; color: var(--ink-3); line-height: 1.5; display: block; }

/* ---------- 口径说明 ---------- */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 20px; }
.metric { border-left: 2px solid var(--line); padding-left: 10px; }
.metric b { font-size: 12px; }
.metric em { font-style: normal; font-size: 10px; color: var(--ink-3); margin-left: 5px; }
.metric p { margin: 3px 0 0; font-size: 11px; color: var(--ink-2); line-height: 1.6; }

/* ---------- 页脚 ---------- */
.foot {
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  font-size: 10.5px; color: var(--ink-3); padding-top: 8px;
  border-top: 1px solid var(--line); margin-top: 8px;
}
.foot a { color: var(--navy-2); text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .overview { grid-template-columns: repeat(2, 1fr); }
  .moverGrid { grid-template-columns: 1fr; gap: 10px; }
  .formGrid { grid-template-columns: repeat(2, 1fr); }
  .field.span2 { grid-column: span 2; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 12px 40px; }
  .brandText h1 { font-size: 15px; }
  .overview { grid-template-columns: 1fr 1fr; }
  .cards { grid-template-columns: 1fr 1fr; }
  .cardPrice b { font-size: 17px; }
}

/* 打印 */
@media print {
  body { background: #fff; }
  .tools, .expGrid, .formActions, .legend { display: none !important; }
  .panel { break-inside: avoid; box-shadow: none; }
}
