:root {
  /* 柔和天蓝：保持年轻明亮，避免高饱和青蓝刺眼 */
  --ink: #1a3550;
  --muted: #5c7388;
  --paper: #f2f7fc;
  --sheet: #ffffff;
  --line: #d5e2ef;
  --rail: #4b91cb;
  --rail-deep: #3877ad;
  --rail-text: #ffffff;
  --rail-muted: #dceef9;
  --copper: #3a7ebc;
  --lacquer: #e11d48;
  --good: #10b981;
  --warn: #f59e0b;
  --accent: #7bb0db;
  --shadow: 0 16px 40px rgba(56, 119, 173, 0.10);
  --serif: "Songti SC", "Noto Serif SC", "STSong", "PMingLiU", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Source Code Pro", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: var(--sans);
  text-wrap: pretty;
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(123, 176, 219, 0.24), transparent 60%),
    radial-gradient(700px 380px at 100% 0%, rgba(75, 145, 203, 0.12), transparent 55%),
    linear-gradient(180deg, #ffffff 0%, transparent 220px),
    var(--paper);
}

button, input { font: inherit; }

button { cursor: pointer; }

.hidden { display: none !important; }

.gate {
  width: min(420px, 100%);
  margin-top: 8px;
}

.panel-head h2 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--rail-deep);
}

.quiet, .panel-head p, .rail-foot {
  color: var(--muted);
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  border: 1px solid #c5d9e6;
  background: #fff;
  color: var(--ink);
  padding: 12px 14px;
  outline: none;
  border-radius: 8px;
}

input[type="number"] {
  appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--copper);
  box-shadow: 0 0 0 3px rgba(61, 126, 184, 0.18);
}

.gate button,
.search-row button,
.text-button {
  border: 0;
}

.gate button,
.search-row button {
  background: var(--rail);
  color: var(--rail-text);
  padding: 12px 18px;
  border-radius: 8px;
}

.gate button {
  min-width: 120px;
  margin-top: 4px;
}

.gate button:hover,
.search-row button:hover { background: var(--rail-deep); }

.tab:hover { background: rgba(255, 255, 255, 0.14); }

.form-error {
  min-height: 1.4em;
  margin: 8px 0;
  color: var(--lacquer);
  font-size: 14px;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

.rail {
  background:
    linear-gradient(165deg, #6aadd8 0%, var(--rail) 48%, #3877ad 100%);
  color: var(--rail-text);
  display: flex;
  flex-direction: column;
  padding: 28px 18px 20px;
}

.tabs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tab {
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--rail-text);
  padding: 12px 12px 12px 14px;
  border-left: 3px solid transparent;
  border-radius: 0 8px 8px 0;
}

.tab.is-active {
  background: rgba(255, 255, 255, 0.18);
  border-left-color: #ffffff;
}

.rail-foot {
  margin-top: auto;
  padding: 18px 8px 0;
  color: var(--rail-muted);
  font-size: 13px;
  line-height: 1.6;
}

.rail-foot p { margin: 0; }

.phone-block span {
  display: block;
  margin-bottom: 2px;
}

.phone-link,
.inline-phone {
  text-decoration: none;
  letter-spacing: 0.03em;
  font-weight: 600;
}

/* 侧栏蓝底：纯白，避免淡黄糊进背景 */
.phone-link {
  color: #ffffff;
  font-size: 16px;
}

/* 留言正文浅底：用强调蓝保证可读 */
.inline-phone {
  color: var(--copper);
  border-bottom: 1px solid rgba(58, 126, 188, 0.45);
}

.message-form {
  width: min(560px, 100%);
}

.message-form button {
  border: 0;
  background: var(--rail);
  color: var(--rail-text);
  padding: 12px 18px;
  border-radius: 8px;
}

.message-form button:hover { background: var(--rail-deep); }

textarea {
  width: 100%;
  border: 1px solid #c5d9e6;
  background: #fff;
  color: var(--ink);
  padding: 12px 14px;
  outline: none;
  resize: vertical;
  font: inherit;
  border-radius: 8px;
}

textarea:focus {
  border-color: var(--copper);
  box-shadow: 0 0 0 3px rgba(61, 126, 184, 0.18);
}

.message-done {
  min-height: 1.4em;
  margin: 0 0 8px;
  color: var(--good);
  font-size: 14px;
}

.text-button {
  margin-top: 8px;
  padding: 0;
  background: transparent;
  color: #ffffff;
  font-weight: 600;
}

main { padding: 36px 40px 64px; }

.panel { max-width: 880px; }

.panel-wide { max-width: min(1120px, 100%); }

.panel-head h2 { margin: 0; font-size: 36px; }

.panel-head p { max-width: 62ch; line-height: 1.7; }

.search-form { margin: 8px 0 22px; }

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

#query { font-family: var(--mono); font-size: 16px; }

.result-slot { min-height: 120px; }

.slip {
  background: var(--sheet);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 22px 24px 18px;
  border-radius: 12px;
}

.slip-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.stamp {
  border: 1px solid var(--good);
  color: var(--good);
  padding: 4px 8px;
  font-size: 13px;
  letter-spacing: 0.08em;
  border-radius: 6px;
}

.stamp.is-fuzzy { border-color: var(--warn); color: #b45309; }

.score { color: var(--muted); font-size: 13px; }

.model-name {
  margin: 18px 0 8px;
  font-family: var(--mono);
  font-size: 22px;
  line-height: 1.45;
  word-break: break-word;
}

.figures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.figures span, .meta, .alt-row span {
  font-size: 14px;
}

.figures small, .meta {
  display: block;
  color: var(--muted);
  margin-bottom: 4px;
}

.order-no, .alt-row strong {
  font-family: var(--mono);
}

.price {
  margin: 0;
  color: var(--lacquer);
  font-family: var(--serif);
  font-size: 40px;
  line-height: 1;
}

.note, .caution {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.caution { color: #b45309; }

.extra { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); }

.extra h3 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.alt-row, .other-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid #e8f2f8;
  font-size: 14px;
}

.other-row { grid-template-columns: 1fr auto; }

.linkish {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-family: var(--mono);
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.soon {
  margin-top: 12px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
}

.soon p { margin: 0 0 6px; font-size: 18px; }

#panel-calc { max-width: 1040px; }

.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 18px;
}

.subtab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 8px;
}

.subtab.is-active {
  background: var(--rail);
  color: var(--rail-text);
  border-color: var(--rail);
}

.calc-block {
  margin: 0 0 16px;
  padding: 18px 18px 8px;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.calc-block h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--rail-deep);
}

.hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

/* 原表里的参考数值，横向对照表在窄屏上可左右滑动。 */
.ref-table-wrap {
  overflow-x: auto;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
}

.ref-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 12px;
  color: var(--ink);
}

.ref-table th,
.ref-table td {
  padding: 8px 6px;
  border-right: 1px solid #e8f2f8;
  text-align: center;
  white-space: nowrap;
}

.ref-table th {
  text-align: left;
  padding-left: 10px;
  color: var(--muted);
  font-weight: 600;
  background: #f3f8fc;
}

.ref-table tr + tr th,
.ref-table tr + tr td {
  border-top: 1px solid #e8f2f8;
}

.ref-table th:last-child,
.ref-table td:last-child {
  border-right: 0;
}

.convert-table { min-width: 860px; font-family: var(--mono); font-size: 12px; }

.convert-table th.is-hit,
.convert-table td.is-hit {
  background: #e8f1f9;
}

.convert-table td.is-match {
  color: var(--copper);
  font-weight: 600;
}

.convert-hit { margin-bottom: 14px; }

.convert-hit-meta {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 18px;
  color: var(--rail-deep);
}

.convert-equiv {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.convert-equiv li {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.convert-equiv li:first-child { border-top: 0; padding-top: 0; }

.convert-brand { color: var(--muted); }

.convert-model { font-family: var(--mono); }

.convert-equiv li.is-match .convert-model { color: var(--copper); font-weight: 600; }

.convert-notes {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px 14px;
  margin-bottom: 14px;
}

.fields label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.fields input,
.fields select {
  margin-top: 6px;
  padding: 10px 12px;
}

.valve-sketch svg {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.valve-sketch .hint { margin-top: 8px; }

.valve-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 12px;
}

.valve-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.valve-legend i {
  width: 22px;
  border-top: 2px solid;
}

.leg-supply { color: var(--rail); }
.leg-return { color: #7c93a8; border-top-style: dashed; }
.leg-move { color: var(--good); }
.leg-resist { color: var(--lacquer); }
.leg-assist { color: var(--good); }

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin: 4px 0 12px;
}

.metrics .form-error,
.metrics .caution { grid-column: 1 / -1; }

.metric {
  padding: 10px 12px;
  background: #f3f8fc;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.metric span,
.metric em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.metric strong {
  display: block;
  margin: 4px 0 2px;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--rail-deep);
}

.tag-ok,
.tag-no {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
}

.tag-ok { color: var(--good); border: 1px solid var(--good); }
.tag-no { color: #b45309; border: 1px solid var(--warn); }

.cycle { margin-bottom: 12px; }

.cycle-head,
.cycle-row {
  display: grid;
  grid-template-columns: 36px 1fr 1fr;
  gap: 8px;
  align-items: center;
}

.cycle-head {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.cycle-row { margin-bottom: 8px; }

.cycle-row input { padding: 10px 12px; }

button:disabled { opacity: 0.6; cursor: wait; }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .rail { padding: 16px; }
  .tabs { flex-direction: row; overflow-x: auto; }
  .tab { border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; border-radius: 8px 8px 0 0; }
  .tab.is-active { border-left-color: transparent; border-bottom-color: #ffffff; }
  .rail-foot { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
  main { padding: 22px 16px 48px; }
  .panel-head h2 { font-size: 30px; }
  .search-row, .figures, .alt-row { grid-template-columns: 1fr; }
  .price { font-size: 34px; }
}
