/* style.css — C 制图/方格本主题 */
:root {
  --bg: #f5f2ea; --grid: #e6e0cd; --ink: #262624;
  --red: #b8392b; --blue: #2c5874; --amber: #c0821e; --mut: #8a8270;
  --line: #d8d1bb; --card: #faf8f0;
  --font-head: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.55;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0/22px 22px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0/22px 22px,
    var(--bg);
}
.wrap { max-width: 880px; margin: 0 auto; padding: 24px 18px 80px; }

/* 标题 */
.topbar { margin-bottom: 22px; }
.topbar h1 { font-family: var(--font-head); font-weight: 700; font-size: 26px; margin: 0 0 2px; letter-spacing: .01em; }
.topbar-sub { font-family: var(--font-head); font-size: 12px; color: var(--mut); margin: 0; letter-spacing: .04em; }

/* 面板 */
.panel { background: var(--card); border: 1.5px solid var(--ink); border-radius: 4px; padding: 20px; margin-bottom: 22px; box-shadow: 3px 3px 0 var(--grid); }
.panel-ttl { font-family: var(--font-head); font-weight: 700; font-size: 16px; margin: 0 0 16px; text-transform: uppercase; letter-spacing: .03em; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.panel-head .panel-ttl { margin: 0; }
.block-ttl { font-family: var(--font-head); font-size: 13px; margin: 22px 0 10px; color: var(--mut); letter-spacing: .04em; }

/* 输入 */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.setting-row label { font-size: 14px; }
.hint { color: var(--mut); font-size: 12px; }
input[type="number"], input[type="text"], select {
  font-family: var(--font-body); font-size: 15px; font-variant-numeric: tabular-nums;
  padding: 7px 10px; border: 1.5px solid var(--ink); border-radius: 3px; background: #fff; color: var(--ink); width: 160px; max-width: 50vw;
}
input:focus, select:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
details { margin: 8px 0 14px; border-left: 3px solid var(--line); padding-left: 12px; }
summary { cursor: pointer; font-size: 13px; color: var(--mut); font-family: var(--font-head); }

/* 按钮 */
.btn { font-family: var(--font-head); font-size: 13px; font-weight: 700; padding: 8px 14px; border: 1.5px solid var(--ink); border-radius: 3px; background: var(--ink); color: #fff; cursor: pointer; letter-spacing: .03em; }
.btn:hover { background: var(--blue); border-color: var(--blue); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--card); color: var(--red); border-color: var(--red); }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn-danger:hover { background: #8f2a1f; border-color: #8f2a1f; }
.btn-sm { font-size: 12px; padding: 4px 9px; }

/* 滑块 */
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 5px; background: var(--line); border-radius: 3px; margin: 8px 0; cursor: pointer; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 22px; background: var(--red); border-radius: 2px; border: none; cursor: pointer; }
.slider::-webkit-slider-thumb:hover { background: #d44634; transform: scaleY(1.08); }
.slider::-moz-range-thumb { width: 14px; height: 22px; background: var(--red); border-radius: 2px; border: none; cursor: pointer; }
.slider::-moz-range-progress { background: var(--red); height: 5px; border-radius: 3px; }

/* 候选卡 */
.cand { border: 1.5px solid var(--line); border-radius: 4px; padding: 16px; margin-bottom: 14px; background: #fff; }
.cand-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.cand-name { font-family: var(--font-head); font-weight: 700; font-size: 16px; flex: 1; min-width: 120px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.field label { display: block; font-size: 12px; color: var(--mut); margin-bottom: 3px; }
.field input, .field select { width: 100%; }
.divider { border-top: 1px dashed var(--line); margin: 12px 0; }
.sub-ttl { font-family: var(--font-head); font-size: 12px; color: var(--mut); margin: 4px 0 8px; letter-spacing: .03em; }
.score-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.score-row .name { width: 84px; font-size: 13px; }
.score-row .slider { flex: 1; }
.score-row .val { width: 36px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* 权重 */
.weight-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.weight-row .name { width: 84px; font-size: 13px; }
.weight-row .slider { flex: 1; }
.weight-row .pct { width: 52px; text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-head); font-size: 13px; color: var(--blue); }

/* 结果：推荐条 */
.rec-bar { border: 1.5px solid var(--red); border-radius: 4px; padding: 14px 16px; margin-bottom: 18px; position: relative; background: rgba(184,57,43,.05); }
.rec-bar .rec-tag { position: absolute; top: -11px; left: 14px; background: var(--red); color: #fff; font-family: var(--font-head); font-size: 11px; font-weight: 700; padding: 2px 10px; letter-spacing: .08em; border-radius: 2px; }
.rec-bar .rec-text { font-size: 15px; }
.rec-empty { color: var(--mut); font-size: 14px; padding: 6px 0; }

/* 结果：表格 */
table.compare { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 15px; }
table.compare th { font-family: var(--font-head); font-size: 12px; color: var(--mut); text-align: right; padding: 8px 6px; border-bottom: 1.5px solid var(--ink); font-weight: 500; letter-spacing: .02em; }
table.compare th:first-child { text-align: left; }
table.compare td { padding: 10px 6px; text-align: right; border-bottom: 1px dotted var(--line); }
table.compare td:first-child { text-align: left; font-weight: 500; }
table.compare tr.rec-row { background: rgba(44,88,116,.10); }
table.compare tr.rec-row td:first-child { color: var(--blue); font-weight: 700; }
table.compare .total { font-weight: 700; color: var(--ink); }
table.compare tr.rec-row .total { color: var(--blue); }
.bar-cell { min-width: 120px; }

/* 成本构成条（三重冗余：配色+分隔线+段内标签） */
.cost-bar { display: flex; height: 18px; border: 1.5px solid var(--ink); border-radius: 3px; overflow: hidden; gap: 3px; padding: 2px; background: #efe8d4; }
.cost-bar i { display: flex; align-items: center; justify-content: center; height: 100%; font-family: var(--font-head); font-size: 10px; color: #fff; font-weight: 700; min-width: 0; overflow: hidden; }
.seg-rent { background: var(--blue); }
.seg-transit { background: var(--red); }
.seg-time { background: var(--amber); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: #5a5446; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend .dot { width: 11px; height: 11px; border-radius: 2px; border: 1px solid var(--ink); display: inline-block; }

/* 页脚 */
.footer { text-align: center; margin-top: 30px; }
.footer .hint { margin-top: 8px; }

/* 响应式：手机转竖向卡片 + 满宽条 */
@media (max-width: 640px) {
  .grid2 { grid-template-columns: 1fr; }
  table.compare thead { display: none; }
  table.compare, table.compare tbody, table.compare tr, table.compare td { display: block; width: 100%; }
  table.compare tr { border: 1px solid var(--line); border-radius: 4px; margin-bottom: 12px; padding: 8px; }
  table.compare td { text-align: left; border: none; padding: 4px 0; display: flex; justify-content: space-between; }
  table.compare td::before { content: attr(data-label); color: var(--mut); font-size: 12px; font-family: var(--font-head); }
  .bar-cell { min-width: 0; }
}
