:root {
  --bg: #f5f6f4;
  --panel: #ffffff;
  --ink: #18231f;
  --muted: #66736e;
  --line: #dce3df;
  --green: #116b5f;
  --green-dark: #0b4d45;
  --warn: #9a5a00;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  /* 关掉双击放大。老板要求页面固定住，而且这个页面没有需要放大才看得清的东西。 */
  touch-action: manipulation;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 56px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { font-size: 20px; font-weight: 800; color: var(--green-dark); }
.topbar nav { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.topbar form { margin: 0; }
.topbar button { border: 0; background: transparent; color: var(--muted); padding: 4px; }

.page { width: min(1120px, 100%); margin: 0 auto; padding: 14px; }
.hero { padding: 12px 0 16px; }
h1, h2 { margin: 0 0 12px; line-height: 1.2; }
h1 { font-size: 28px; }
h2 { font-size: 19px; }
.eyebrow { margin: 0 0 6px; color: var(--green); font-weight: 700; font-size: 13px; }
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
}
.status-badge.retired {
  background: #f2e7de;
  color: #8a4a16;
}
.muted { color: var(--muted); }
.error { color: #b42318; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}
.section-head, .two {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.stack-form { display: grid; gap: 12px; max-width: 520px; }
.stack-form label { display: grid; gap: 6px; font-weight: 700; }
.sync-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.sync-summary span { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fbfcfb; font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
td:last-child { white-space: normal; min-width: 140px; }

.search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 8px;
}
.search-box { position: relative; min-width: 0; }
.search-form .primary { align-self: start; }
.search-suggestions {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(460px, 70vh);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 28px rgba(24, 35, 31, 0.14);
}
.search-suggestion {
  display: grid;
  grid-template-columns: minmax(160px, 1.4fr) minmax(120px, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 6px;
}
.search-suggestion:hover, .search-suggestion.active { background: #edf4f1; }
.search-suggestion strong,
.search-suggestion span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-suggestion span { color: var(--muted); }
.search-suggestion em {
  padding: 2px 7px;
  border-radius: 999px;
  background: #e7f3ef;
  color: var(--green-dark);
  font-size: 12px;
  font-style: normal;
  white-space: nowrap;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 8px 10px;
  background: #fff;
  /* 必须 >= 16px：iOS Safari 有个硬规则——聚焦一个字号小于 16px 的输入框时，
     它会自动把整页放大，而且不会自己缩回去。老板一点搜索框整页就被顶歪了。
     这不是「样式偏好」，是 iOS 的行为开关，别按视觉喜好调小。 */
  font-size: 16px;
}
textarea { min-height: 86px; resize: vertical; }
.primary, .button {
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  min-height: 42px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.primary:hover, .button:hover { background: var(--green-dark); }
.secondary { background: #eef4f1; color: var(--green-dark); border: 1px solid var(--line); }
.secondary:hover { background: #dcebe5; }

.list { display: grid; gap: 8px; }
.list-row, .compact-row {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}
.list-row span, .compact-row span { color: var(--muted); }
.list-row em {
  width: max-content;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e7f3ef;
  color: var(--green-dark);
  font-size: 12px;
  font-style: normal;
}
.trend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  align-items: start;
  gap: 10px;
}
.trend-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}
.trend-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.trend-head > div { display: grid; gap: 3px; min-width: 0; }
.trend-head span { color: var(--muted); font-size: 12px; margin: 0; }
.trend-latest { text-align: right; justify-items: end; }
.trend-latest strong { font-size: 22px; line-height: 1; }
.trend-delta {
  width: max-content;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef2f0;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}
.trend-delta.up { background: #fff1df; color: #9a4f00; }
.trend-delta.down { background: #e7f3ef; color: var(--green-dark); }
.price-chart {
  min-width: 0;
  margin-top: 4px;
}
.price-chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.price-range-switch {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(70px, auto);
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f6f4;
}
/* 时间范围是 <a> 不是 <button>（见 yarn_detail.html 的说明）。两种都选中，
   免得哪天改回按钮样式又丢。 */
.price-range-switch button,
.price-range-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #52514e;
  font-weight: 700;
  cursor: pointer;
}
.price-range-switch button.active,
.price-range-switch a.active {
  background: #fff;
  color: #0b0b0b;
  box-shadow: 0 1px 4px rgba(11, 11, 11, 0.12);
}
.price-range-switch button:focus-visible,
.price-range-switch a:focus-visible,
.price-chart-legend button:focus-visible,
.price-chart-point:focus-visible {
  outline: 2px solid #0b0b0b;
  outline-offset: 2px;
}
.price-chart-unit {
  color: #52514e;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.price-chart-body {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  margin-top: 10px;
}
.price-chart-y-axis {
  position: relative;
  height: 320px;
  color: #898781;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.price-chart-range-layer {
  position: absolute;
  inset: 0;
}
.price-chart-range-layer.is-range-hidden,
[data-chart-series-element].is-series-hidden {
  display: none !important;
}
.price-chart-y-axis span {
  position: absolute;
  right: 0;
  transform: translateY(-50%);
  white-space: nowrap;
}
.price-chart-main { min-width: 0; }
.price-chart-plot {
  position: relative;
  height: 320px;
  min-width: 0;
  background: #fff;
}
.price-chart-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 320px;
  overflow: visible;
}
.price-chart-gridline {
  stroke: #e1e0d9;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.price-chart-line {
  fill: none;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.price-chart-line.unknown { stroke-dasharray: 7 5; }
.price-chart-point-layer {
  pointer-events: none;
}
.price-chart-point {
  position: absolute;
  z-index: 3;
  width: 24px;
  height: 24px;
  min-height: 24px;
  margin: 0;
  padding: 0;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}
.price-chart-dot {
  display: block;
  width: 8px;
  height: 8px;
  margin: auto;
  border: 2px solid var(--series-color);
  border-radius: 50%;
  background: var(--series-color);
  transition: transform 120ms ease;
}
.price-chart-dot.hollow { background: #fff; }
.price-chart-point:hover .price-chart-dot,
.price-chart-point:focus-visible .price-chart-dot { transform: scale(1.35); }
.price-chart-tail-label {
  position: absolute;
  z-index: 2;
  right: 3px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 45%;
  padding: 2px 4px;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.88);
  color: #0b0b0b;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
.price-chart-tail-label i {
  width: 13px;
  height: 3px;
  flex: 0 0 auto;
  border-radius: 2px;
}
.price-chart-tooltip {
  position: absolute;
  z-index: 12;
  display: grid;
  gap: 3px;
  width: max-content;
  max-width: min(270px, calc(100% - 12px));
  padding: 9px 10px;
  transform: translate(-50%, calc(-100% - 8px));
  border-radius: 6px;
  background: #0b0b0b;
  color: #fff;
  box-shadow: 0 4px 12px rgba(11, 11, 11, 0.22);
  font-size: 12px;
  line-height: 1.35;
  pointer-events: none;
}
.price-chart-tooltip[hidden] { display: none; }
.price-chart-tooltip.below { transform: translate(-50%, 8px); }
.price-chart-tooltip span { color: #fff; }
.price-chart-tooltip strong { color: #fff; font-size: 13px; }
.price-chart-x-axis {
  position: relative;
  height: 30px;
  color: #898781;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.price-chart-x-axis span {
  position: absolute;
  top: 7px;
  white-space: nowrap;
}
.price-chart-x-axis span.middle { transform: translateX(-50%); }
.price-chart-x-axis span.end { transform: translateX(-100%); }
.price-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.price-chart-legend button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  min-width: 0;
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid #d9d8d2;
  border-radius: 8px;
  background: #fff;
  color: #0b0b0b;
  cursor: pointer;
}
.price-chart-legend button.is-off {
  opacity: 0.48;
  background: #f5f6f4;
}
.price-chart-legend i {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
}
.price-chart-legend span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.price-chart-legend strong {
  color: #0b0b0b;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.price-chart-legend small {
  color: #898781;
  font-size: 10px;
  white-space: nowrap;
}
.tax-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid #bcd8cf;
  background: #e7f3ef;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.tax-badge.incl { border-color: #ecc68c; background: #fff4df; color: #8c5200; }
.tax-badge.excl { border-color: #bcd8cf; background: #e7f3ef; color: var(--green-dark); }
.tax-badge.unknown { border-color: #d5dbd8; background: #eef2f0; color: var(--muted); }
.source-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid #c8d8d2;
  background: #f4f7f5;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.source-badge.origin { border-color: #b7d9cd; background: #e7f3ef; }
.source-badge.reseller { border-color: #d6c7a6; background: #fff7e7; color: #8c5200; }
.source-price-hint {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #e7f3ef;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.trend-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.trend-stats span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
}
.trend-stats b {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.trend-changes {
  display: grid;
  gap: 5px;
}
.trend-change {
  display: grid;
  grid-template-columns: minmax(96px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}
.trend-change span {
  min-width: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.trend-detail { margin-top: 12px; }
.voided { opacity: 0.65; }
.voided strong, .voided span { text-decoration: line-through; }
.quote-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.quote-actions form { margin: 0; }
.quote-actions button, .small-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--green-dark);
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 14px; }
th { background: #edf4f1; }
td span { color: var(--muted); font-size: 12px; }

.stack { display: grid; gap: 12px; }
.fast-form { max-width: 680px; }
.inline-upload-toggle summary {
  width: max-content;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--green-dark);
  cursor: pointer;
}
.inline-upload { display: grid; gap: 6px; min-width: 220px; }
.inline-upload input { min-height: 34px; padding: 5px 8px; }
.inline-upload button { min-height: 34px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

.supplier-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.supplier-card > summary { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; cursor: pointer; }
.supplier-readonly {
  display: grid;
  gap: 5px;
  margin: 8px 0;
}
.supplier-readonly p, .erp-summary { margin: 0; }
.supplier-readonly b {
  display: inline-block;
  min-width: 64px;
  margin-right: 8px;
  color: var(--muted);
}
.erp-summary { color: var(--muted); font-size: 12px; }
.supplier-edit { margin: 8px 0 12px; }
.supplier-edit > summary {
  width: max-content;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green-dark);
  background: #fff;
  cursor: pointer;
}
.supplier-note-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(180px, 0.8fr) auto; gap: 8px; align-items: end; margin: 10px 0 12px; }
.supplier-note-form textarea { min-height: 42px; }
.supplier-note-form button { min-height: 42px; border: 1px solid var(--line); border-radius: 8px; background: var(--green); color: #fff; padding: 0 12px; font-weight: 700; }
.truncated-note {
  margin: 0 0 10px;
  padding: 7px 10px;
  border: 1px solid #ecc68c;
  border-radius: 6px;
  background: #fff4df;
  color: #8c5200;
  font-size: 13px;
}

.color-hit { display: flex; align-items: center; gap: 10px; }
.color-hit-thumb { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 6px; border: 1px solid var(--line); object-fit: cover; }
.color-hit-thumb-empty { display: grid; place-items: center; background: #f2f5f3; color: var(--muted); font-size: 11px; }
.color-hit-body { display: grid; gap: 2px; min-width: 0; }

.card-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.card-upload input[type="file"] { flex: 1 1 190px; width: auto; min-height: 34px; font-size: 13px; }
.card-upload input[name="caption"] { flex: 1 1 130px; width: auto; min-height: 34px; font-size: 13px; }
.card-upload button { min-height: 34px; border: 1px solid var(--line); border-radius: 6px; background: var(--green); color: #fff; padding: 0 12px; font-weight: 700; font-size: 12px; }

.price-notes { margin: 10px 0 4px; padding-top: 8px; border-top: 1px solid #eef2f0; }
.price-notes-title { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--green-dark); }
.price-notes-title .muted { font-weight: 400; font-size: 12px; }
.price-note-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.price-note-price { min-width: 58px; font-size: 15px; color: var(--green-dark); }
.price-note-count { min-width: 44px; color: var(--muted); font-size: 12px; }
.price-note-row select { width: auto; min-height: 32px; }
.price-note-row input { flex: 1 1 130px; width: auto; min-height: 32px; font-size: 13px; }
.price-note-row button { min-height: 32px; border: 1px solid var(--line); border-radius: 6px; background: var(--green); color: #fff; padding: 0 11px; font-weight: 700; font-size: 12px; }

.tax-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 2px; }
.tax-form-label { color: var(--muted); font-size: 12px; }
.tax-form select { min-height: 32px; }
.tax-form input { width: 74px; min-height: 32px; }
.tax-form button { min-height: 32px; border: 1px solid var(--line); border-radius: 6px; background: var(--green); color: #fff; padding: 0 11px; font-weight: 700; font-size: 12px; }
.cards { display: flex; flex-wrap: wrap; gap: 10px; }
.color-card { width: 130px; display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.color-card img { width: 100%; aspect-ratio: 1.3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.shared-card img { border-color: #c9ddcf; }
.shared-card span { color: var(--green-dark); }

.login-body { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-panel { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 20px; }

@media (max-width: 720px) {
  .topbar { align-items: flex-start; gap: 8px; flex-direction: column; }
  .topbar nav { width: 100%; justify-content: space-between; }
  .grid, .search-form, .section-head, .two, .supplier-note-form { grid-template-columns: 1fr; display: grid; }
  .search-suggestion { grid-template-columns: 1fr auto; }
  .search-suggestion span { grid-column: 1 / -1; }
  .trend-grid { grid-template-columns: 1fr; }
  .trend-head { display: grid; }
  .trend-latest { text-align: left; justify-items: start; }
  .trend-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trend-change { grid-template-columns: 1fr auto; }
  .trend-change .trend-delta { grid-column: 2; }
  .price-chart-toolbar { align-items: stretch; flex-direction: column; gap: 6px; }
  .price-range-switch { width: 100%; grid-auto-columns: 1fr; }
  .price-chart-body { grid-template-columns: 46px minmax(0, 1fr); gap: 5px; }
  .price-chart-y-axis, .price-chart-x-axis { font-size: 10px; }
  .price-chart-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .price-chart-legend button {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    width: 100%;
    min-height: 44px;
    gap: 3px 5px;
    text-align: left;
  }
  .price-chart-legend small { grid-column: 2 / -1; }
  .price-chart-tail-label { max-width: 54%; }
  .actions { justify-content: stretch; }
  .button, .primary { width: 100%; }
  h1 { font-size: 24px; }
}

:root {
  --bg: #f3f5f2;
  --panel: #ffffff;
  --ink: #16251e;
  --muted: #64736b;
  --line: #d7e0da;
  --line-strong: #bdcbc2;
  --green: #087563;
  --green-dark: #075649;
  --green-soft: #e6f2ed;
  --amber: #9a5d12;
  --amber-soft: #fff4df;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
}

body {
  min-height: 100vh;
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}

.topbar {
  min-height: 64px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom-color: #dfe6e1;
  box-shadow: 0 1px 0 rgba(22, 37, 30, 0.03);
}

.topbar-inner {
  display: flex;
  width: min(1180px, 100%);
  min-height: 64px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  background: var(--green);
  color: #fff;
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.topbar nav {
  gap: 2px;
  font-size: 13px;
  font-weight: 700;
}

.nav-link,
.logout-button,
.nav-add {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #4e5e56;
  white-space: nowrap;
}

.nav-link:hover,
.logout-button:hover {
  background: #f0f5f2;
  color: var(--green-dark);
}

.nav-add {
  width: 36px;
  padding: 0;
  border-color: var(--line-strong);
  color: var(--green-dark);
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}

.nav-add:hover {
  border-color: var(--green);
  background: var(--green-soft);
}

.nav-divider {
  width: 1px;
  height: 20px;
  margin: 0 4px;
  background: var(--line);
}

.topbar form { display: flex; }
.topbar button.logout-button { min-height: 36px; padding: 0 10px; color: #4e5e56; }

.page {
  width: min(1180px, 100%);
  padding: 28px 24px 56px;
}

h1,
h2 { color: var(--ink); letter-spacing: 0; }
h1 { margin-bottom: 6px; font-size: 30px; line-height: 1.2; }
h2 { margin-bottom: 0; font-size: 17px; line-height: 1.35; }

.hero { padding: 4px 0 22px; }
.search-hero { max-width: 760px; }
.eyebrow { margin-bottom: 5px; color: var(--green); font-size: 12px; letter-spacing: 0; }
.muted { color: var(--muted); }

.panel {
  margin-bottom: 16px;
  padding: 20px;
  border-color: var(--line);
  border-radius: 6px;
  box-shadow: 0 1px 1px rgba(22, 37, 30, 0.02);
}

.section-head {
  align-items: center;
  min-height: 28px;
  margin-bottom: 14px;
}

.section-count {
  min-width: 24px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.text-action {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 700;
}

.text-action:hover { text-decoration: underline; }

.search-form {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

input,
select,
textarea {
  min-height: 44px;
  padding: 9px 11px;
  border-color: var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  box-shadow: inset 0 1px 1px rgba(22, 37, 30, 0.02);
}

input::placeholder,
textarea::placeholder { color: #8b9891; }

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  outline: 3px solid rgba(8, 117, 99, 0.14);
  outline-offset: 0;
}

textarea { min-height: 96px; }

.primary,
.button {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 6px;
  background: var(--green);
  box-shadow: 0 1px 1px rgba(5, 75, 63, 0.16);
}

.primary:hover,
.button:hover { background: var(--green-dark); }

.button.secondary {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--green-dark);
  box-shadow: none;
}

.button.secondary:hover { border-color: var(--green); background: var(--green-soft); }

.search-suggestions {
  padding: 5px;
  border-color: var(--line-strong);
  border-radius: 6px;
  box-shadow: 0 12px 30px rgba(22, 37, 30, 0.16);
}

.search-suggestion { min-height: 48px; border-radius: 5px; }
.search-suggestion:hover,
.search-suggestion.active { background: var(--green-soft); }

.dashboard-grid { gap: 16px; }
.dashboard-panel { min-height: 188px; }
.compact-row,
.list-row {
  gap: 5px;
  padding: 12px 13px;
  border-color: #e0e7e2;
  border-radius: 6px;
  background: #fcfdfc;
  transition: border-color 120ms ease, background 120ms ease;
}

a.compact-row:hover,
a.list-row:hover {
  border-color: #b9cec4;
  background: #f5faf7;
}

.record-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 20px;
  padding: 2px 0 22px;
  border-bottom: 1px solid var(--line);
}

.record-head h1 { margin-bottom: 8px; }
.record-head p:not(.eyebrow) { margin: 3px 0; color: #4d5c54; }
.record-actions { flex: 0 0 auto; }

.headline {
  display: grid;
  gap: 5px;
  margin: 0 0 14px;
  padding: 11px 13px;
  border: 1px solid #dbe4de;
  border-radius: 8px;
  background: #f6faf8;
}
.headline-row { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.headline-row strong { font-size: 21px; color: var(--green-dark); }
.headline-tag { min-width: 28px; color: var(--muted); font-size: 12px; }
.headline-tag.low { color: var(--green-dark); font-weight: 700; }
.headline-unit { color: var(--muted); font-size: 12px; }
.headline-meta { margin: 0; color: var(--muted); font-size: 12px; }
.headline-warn { color: #8c5200; }

.tier-badge {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid #c8d8d2;
  background: #f4f7f5;
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.tier-badge.none { border-color: #d5dbd8; background: #eef2f0; color: var(--muted); }
.tier-summary { color: var(--muted); font-size: 12px; }
.tier-note { color: var(--muted); font-size: 11px; }
.tier-note.none { color: #8c5200; }
.quote-sheet { margin: 6px 0; padding: 6px 0; border-bottom: 1px solid #eef2f0; }
.quote-sheet > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; cursor: pointer; }

.comparison-panel { padding-bottom: 10px; }

table { min-width: 720px; }
th,
td { padding: 12px 10px; border-bottom-color: #e1e7e3; }
th {
  background: #f1f6f3;
  color: #506057;
  font-size: 12px;
  font-weight: 800;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdfb; }

.tax-badge,
.source-badge,
.source-price-hint,
.status-badge {
  border-radius: 999px;
  font-size: 11px;
}

.supplier-panel { padding-bottom: 12px; }
.supplier-card {
  margin-bottom: 10px;
  padding: 13px;
  border-color: #dbe4de;
  border-radius: 6px;
  background: #fcfdfc;
}

details > summary {
  list-style: none;
  cursor: pointer;
}

details > summary::-webkit-details-marker { display: none; }
.supplier-card > summary::after,
.trend-detail > summary::after,
.inline-upload-toggle summary::after,
.supplier-edit > summary::after {
  margin-left: auto;
  color: var(--green-dark);
  content: "+";
  font-size: 17px;
  line-height: 1;
}

.supplier-card[open] > summary::after,
.trend-detail[open] > summary::after,
.inline-upload-toggle[open] summary::after,
.supplier-edit[open] > summary::after { content: "-"; }

.supplier-card > summary { min-height: 28px; }
.supplier-readonly { margin: 12px 0; }
.supplier-edit { padding-top: 8px; border-top: 1px solid #e3e9e5; }
.supplier-edit > summary,
.inline-upload-toggle summary {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 5px;
}

.inline-upload-toggle summary {
  min-height: 34px;
  padding: 5px 9px;
  color: var(--green-dark);
}

.supplier-note-form { margin-top: 12px; }
.supplier-note-form button { border-radius: 6px; background: var(--green); }
.color-card { width: 148px; }
.color-card img { border-radius: 6px; }

.trend-card,
.trend-change,
.trend-stats span { border-radius: 6px; }
.trend-card { background: #fcfdfc; }
.price-chart-plot { background: transparent; }
.price-range-switch,
.price-chart-legend button { border-radius: 6px; }
.price-range-switch { background: #f1f5f2; }
.price-chart-legend button { border-color: var(--line); }

.form-page {
  width: min(720px, 100%);
  margin: 0 auto;
}

.form-heading { margin: 2px 0 18px; }
.form-shell {
  max-width: none;
  padding: 20px;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 1px 1px rgba(22, 37, 30, 0.02);
}

.form-shell label { color: #33453c; font-size: 13px; }
.form-shell .two { gap: 12px; }
.form-submit {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
  border-top: 1px solid #e2e8e3;
}
.form-submit .primary { min-width: 140px; }

.sync-summary { gap: 7px; }
.sync-summary span {
  padding: 6px 9px;
  border-color: var(--line);
  border-radius: 999px;
  background: #f6faf8;
  color: #395047;
}

.login-body { background: #eff3f0; }
.login-panel {
  padding: 28px;
  border-radius: 7px;
  box-shadow: 0 12px 30px rgba(22, 37, 30, 0.1);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 26px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
}
.login-panel h1 { font-size: 24px; }

@media (max-width: 720px) {
  .topbar { min-height: 54px; padding: 0 14px; }
  .topbar-inner { min-height: 54px; gap: 10px; }
  .brand { gap: 7px; font-size: 15px; }
  .brand-mark { width: 25px; height: 25px; border-radius: 6px; font-size: 16px; }
  .topbar nav { gap: 0; overflow-x: auto; }
  .nav-link { min-height: 34px; padding: 0 7px; font-size: 12px; }
  .nav-add { width: 32px; min-height: 32px; font-size: 20px; }
  .nav-divider,
  .logout-button { display: none !important; }
  .page { padding: 20px 14px 40px; }
  .hero { padding-bottom: 18px; }
  h1 { font-size: 26px; }
  .panel { padding: 15px; margin-bottom: 12px; }
  .search-form { gap: 8px; }
  .search-form .primary { width: auto; padding: 0 14px; }
  .record-head { display: grid; gap: 16px; padding-bottom: 18px; }
  .record-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .record-actions .button { width: 100%; }
  .supplier-card { padding: 11px; }
  .color-card { width: calc(50% - 5px); }
  .form-shell { padding: 15px; gap: 14px; }
  .form-submit .primary { width: 100%; }
  .form-submit { display: block; }
}

/* 手机上把比价表拆成卡片。
   表格设了 min-width:720px 并靠 overflow-x 横向滚动，而手机大约 390px 宽，
   于是「毛行 / 最近成交 / 最近报价」永远无法同屏——可比价恰恰就是要同屏对比。
   一行一张卡，竖排，不用横拉。放在文件末尾以盖过上面无条件的 min-width。 */
@media (max-width: 720px) {
  .comparison-panel .table-wrap { overflow-x: visible; }
  .comparison-panel table { display: block; min-width: 0; }
  .comparison-panel thead { display: none; }
  .comparison-panel tbody { display: block; }
  .comparison-panel tr {
    display: grid;
    gap: 7px;
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }
  .comparison-panel td {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 8px;
    align-items: baseline;
    padding: 0;
    border: 0;
    font-size: 14px;
    min-width: 0;
  }
  .comparison-panel td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
  }
  .comparison-panel td.cell-provider {
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: 8px;
    border-bottom: 1px solid #eef2f0;
    font-size: 16px;
    font-weight: 700;
  }
  .comparison-panel td.cell-provider::before { display: none; }
}

/* 截断提示：大表只渲染最近 N 条，这行说明「共多少条」并给出全量入口。
   不做静默截断——看到的不是全部时，必须让人一眼知道。 */
.truncation-note {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-top: 1px solid var(--line, #e5e7eb);
  font-size: 13px;
}

.truncation-note a {
  margin-left: 2px;
  font-weight: 600;
  white-space: nowrap;
}

/* 视觉隐藏但仍在无障碍树和表单里——密码管理器需要看得见这个用户名字段，
   display:none / type=hidden 都会被它们跳过，那样手机就不弹「保存密码」。 */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* 搜索结果里的价格。老板搜一支纱多半只想知道多少钱，
   把它做成这一行里最显眼的东西，让他不必点进详情页。 */
.row-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin-top: 2px;
  color: var(--green-dark);
  font-size: 13px;
}
.row-price b {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.row-price i {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.section-actions { display: flex; gap: 8px; align-items: center; }
.button.ghost {
  background: #fff;
  color: var(--green-dark);
  border: 1px solid var(--line);
}
.button.ghost.copied {
  background: var(--green-dark);
  color: #fff;
  border-color: var(--green-dark);
}

/* 下拉上面的筛选框。比选择器本身矮一点、浅一点——它是辅助，不是主角。 */
.picker-filter {
  margin-bottom: 6px;
  min-height: 38px;
  background: #fbfcfb;
}

/* 比价表里每家毛行的「录这家报价」。做小、做淡——它是顺手的动作，不该抢价格的注意力。 */
.row-action {
  display: inline-block;
  margin-top: 4px;
  color: var(--green);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* 「最近看过」快捷条。横向可滚，手机上不换行占高度；
   做得比搜索框淡——它是捷径，不该跟主输入抢注意力。 */
.recent-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.recent-chips::-webkit-scrollbar { display: none; }
.recent-chips-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}
.recent-chip {
  flex: 0 0 auto;
  max-width: 12em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--green-dark);
  font-size: 13px;
}
.recent-chip:active { background: #eef4f1; }

/* ERP 连不上时的顶部说明。用琥珀色而不是红色：这是暂时的外部状态，
   不是错误也不是数据出了问题，本地的东西照常能用。 */
.offline-banner {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid #e6d3a3;
  border-left: 3px solid #c8912f;
  border-radius: 8px;
  background: #fdf8ec;
  color: #6b5320;
  font-size: 13px;
  line-height: 1.55;
}
.offline-banner strong { color: #8a6414; }

/* 破坏性动作。不用大红——它是可撤销的，吓人没必要；
   但也不能和「修正」长得一样，那才是误触的根源。 */
.danger-button {
  border: 1px solid #e0c4c4 !important;
  background: #fdf6f6 !important;
  color: #8c3b3b !important;
}

/* 税点，以及「这两个档位其实是同一个价」的指认。
   安静一点：它是说明不是警告，别抢价格本身的注意力。 */
.tax-points-row { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-bottom: .5rem; }
.tax-points-row input { width: 4.5rem; }
.tax-twin { font-size: .8rem; color: #6b7a8f; background: #f2f5f9; border-radius: 3px; padding: 0 .35rem; }

/* 毛种改名断链。和「连不上 ERP」那条同一个模子，但换成蓝调：
   那条是「现在什么都看不到」，这条是「有几支纱的价没了，可以修」——
   都需要注意，但不是同一件事，长得一样他就会当成同一件事略过去。 */
.broken-links-banner {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid #cfdcea;
  border-left: 3px solid #4a7ab5;
  border-radius: 8px;
  background: #f4f8fc;
  color: #3d5570;
  font-size: 13px;
  line-height: 1.55;
}
.broken-links-banner strong { color: #23486f; }
.broken-links-banner a { color: #2c5b96; }

/* 就地标税基。安静：它是顺手可做的一件事，不是又一个警告。
   手机上两组会自动折行，所以用 flex + wrap 而不是固定排布。 */
.tax-mark-row {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: .35rem .7rem; margin: .4rem 0 0; font-size: 13px;
}
.tax-mark-item { display: flex; align-items: center; gap: .3rem; }
.tax-mark-item form { display: flex; gap: .2rem; }
.tax-mark-who { color: #4a5666; }
.tax-mark-item button {
  padding: 1px 8px; font-size: 12px; line-height: 1.7;
  border: 1px solid #cfd8e3; background: #fff; color: #3d5570; border-radius: 999px;
}

/* 成批录报价单。一张单几十行，所以行要紧凑，输入框要够大能点中。 */
.sheet-head { display: grid; gap: .6rem; margin-bottom: 1rem; }
.sheet-rows { width: 100%; border-collapse: collapse; }
.sheet-rows th { text-align: left; font-size: 12px; color: #6b7a8f; font-weight: 500; padding: 0 0 .3rem; }
.sheet-rows th.price-col, .sheet-rows td.price-col { width: 8.5rem; }
.sheet-rows td { padding: 0 0 .35rem; }
.sheet-rows td input { width: 100%; }
.sheet-rows td.price-col input { text-align: right; }
.sheet-saved {
  margin: 0 0 12px; padding: 10px 12px; border: 1px solid #cde3cd;
  border-left: 3px solid #4a8a4a; border-radius: 8px; background: #f5faf5;
  color: #3a5c3a; font-size: 13px;
}
.sheet-errors {
  margin: 0 0 12px; padding: 10px 12px; border: 1px solid #e6c9c9;
  border-left: 3px solid #b55; border-radius: 8px; background: #fdf6f6;
  color: #7a3a3a; font-size: 13px;
}
.sheet-errors ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.sheet-errors li { margin: .15rem 0; }
.section-actions { display: flex; gap: .8rem; }

/* 录单页的色档列。手机上三列会挤，所以色档列可窄可伸。 */
.sheet-rows th.tier-col, .sheet-rows td.tier-col { width: 30%; }
.sheet-create-toggle {
  display: flex; align-items: center; gap: .4rem;
  margin-top: .6rem; font-size: 13px; color: #7a3a3a;
}
.sheet-create-toggle input { width: auto; }

/* 备份到期提醒。灰调：它是件家务，不是故障。 */
.backup-banner {
  margin: 0 0 14px; padding: 10px 12px;
  border: 1px solid #d9dde3; border-left: 3px solid #7a8794; border-radius: 8px;
  background: #f6f7f9; color: #4a5666; font-size: 13px; line-height: 1.55;
}
.backup-banner strong { color: #33404e; }

/* 首页「最近报价」里跨多支纱的单：标题是单，下面一排纱名各自可点。 */
.sheet-row { display: block; }
.sheet-yarns { display: flex; flex-wrap: wrap; gap: .3rem .4rem; margin-top: .35rem; }
.sheet-yarns a {
  font-size: 12px; line-height: 1.6; padding: 0 .55rem; border-radius: 999px;
  border: 1px solid #d7dde6; background: #fff; color: #2c5b96; text-decoration: none;
}
.sheet-yarns em { font-size: 12px; color: var(--muted); font-style: normal; align-self: center; }
.row-others { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }

/* =====================================================================
   打磨层（2026-09-05）。老板看了截图说「不够商业化」。
   放在文件末尾靠层叠覆盖，不去动上面那些带着历史原因的规则。
   原则不变：一个色相（绿）+ 中性灰，一套圆角/投影/字号阶梯，视觉安静。
   ===================================================================== */
:root {
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-1: 0 1px 2px rgba(20, 35, 28, .05), 0 8px 20px -14px rgba(20, 35, 28, .22);
  --shadow-2: 0 2px 4px rgba(20, 35, 28, .06), 0 14px 30px -16px rgba(20, 35, 28, .28);
  --ring: 0 0 0 3px rgba(17, 107, 95, .18);
  --line-soft: #e6ebe8;
}
body { font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }

/* 页头：更像一个产品的顶栏，「录报价」是主操作 */
.topbar { box-shadow: 0 1px 0 var(--line-soft); border-bottom: 0; background: rgba(255,255,255,.92); backdrop-filter: saturate(140%) blur(8px); }
.brand { display: inline-flex; align-items: center; gap: 9px; letter-spacing: .02em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; font-weight: 800; box-shadow: inset 0 -1px 0 rgba(0,0,0,.12); }
.nav-link { border-radius: 999px; color: #3d4d45; font-weight: 600; }
.nav-link:hover { background: #eef4f1; }
.nav-primary, .nav-primary:hover { background: var(--green); color: #fff; padding: 0 14px; }
.nav-primary:hover { background: var(--green-dark); }
.nav-add { border-radius: 999px; }

/* 面板与卡片 */
.panel, .form-shell { border-radius: var(--radius); border-color: var(--line-soft); box-shadow: var(--shadow-1); }
.list-row, .compact-row { border-radius: 10px; border-color: var(--line-soft); background: #fff; transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease; }
a.list-row:hover, a.compact-row:hover { border-color: #cfdcd5; box-shadow: var(--shadow-1); transform: translateY(-1px); background: #fff; }
.section-head h2 { font-size: 16px; letter-spacing: .01em; }
.section-count { background: #f1f5f3; border-color: transparent; font-weight: 600; }
.eyebrow { letter-spacing: .12em; text-transform: uppercase; font-size: 11.5px; }

/* 控件：触得准、看得清 */
input, select, textarea { border-radius: 10px; min-height: 44px; border-color: #d3dbd6; transition: border-color 120ms ease, box-shadow 120ms ease; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: var(--ring); }
.primary, .button { border-radius: 10px; min-height: 44px; font-weight: 700; letter-spacing: .01em; box-shadow: 0 1px 0 rgba(0,0,0,.06); }
.primary:active, .button:active { transform: translateY(1px); }
.button.ghost { background: #fff; color: var(--green-dark); border: 1px solid #cfdcd5; box-shadow: none; }
.button.ghost:hover { background: #f1f6f3; }

/* 首页检索区：这是入口，给它一点分量 */
.search-hero { padding: 6px 0 22px; }
.search-hero h1 { font-size: 30px; letter-spacing: -.01em; }
.search-form input { min-height: 50px; font-size: 16px; padding-left: 14px; border-radius: 12px; }
.search-form .primary { min-height: 50px; border-radius: 12px; padding: 0 20px; }

/* 首页两块列表的表头：计数与操作靠右，不换行 */
.dashboard-panel .section-head { display: flex; flex-direction: row; align-items: center; justify-content: space-between; }
.section-actions { flex-wrap: wrap; justify-content: flex-end; }
.section-actions .text-action { padding: 4px 10px; border-radius: 999px; background: #f1f5f3; font-weight: 600; }

/* 纱线页首屏结论：价格是主角 */
.headline { border-radius: var(--radius); background: linear-gradient(180deg, #f4faf7 0%, #f8fbf9 100%); border-color: var(--line-soft); padding: 14px 16px; }
.headline-row strong { font-size: 26px; letter-spacing: -.01em; }
.headline-tag { font-weight: 700; }

/* 录单表：别再被全局 min-width 撑爆 */
.sheet-rows { min-width: 0; table-layout: fixed; }
.sheet-rows td input { min-height: 40px; }

/* render_price 宏把数字包在 b.price-view 里。平时不加粗，表格保持安静；
   手机比价卡的「最近成交」靠它放大变绿（见下面媒体查询）。 */
.price-view { font-weight: inherit; }

@media (max-width: 720px) {
  .page { padding: 16px 12px 40px; }
  .search-hero h1 { font-size: 26px; }
  .panel { padding: 14px; }

  /* 首页：计数和操作按钮不再被拉成整条横杠 */
  .dashboard-panel .section-head { display: flex; }
  .section-count { min-width: 26px; }

  /* 比价：每家两行——上行「毛行 …… 最近成交价」，下行日期/档位/报价，不再是一张高卡 */
  .comparison-panel tr { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 10px 12px; align-items: baseline; }
  .comparison-panel td.cell-provider { grid-column: 1; grid-row: 1; padding-bottom: 0; border-bottom: 0; font-size: 15px; display: block; }
  .comparison-panel td.cell-provider .row-action { display: inline-block; margin-left: 6px; font-size: 12px; font-weight: 400; }
  .comparison-panel td[data-label="最近成交"] { grid-column: 2; grid-row: 1 / span 2; display: block; text-align: right; font-size: 13px; color: var(--muted); }
  .comparison-panel td[data-label="最近成交"]::before { display: none; }
  .comparison-panel td[data-label="最近成交"] .price-view, .comparison-panel td[data-label="最近成交"] b, .comparison-panel td[data-label="最近成交"] strong { font-size: 18px; font-weight: 700; color: var(--green-dark); }
  .comparison-panel td[data-label="最近报价"] { grid-column: 1; grid-row: 2; display: block; font-size: 12.5px; color: var(--muted); }
  .comparison-panel td[data-label="最近报价"]::before { content: "报价 "; display: inline; }
  .comparison-panel td[data-label="最近报价"] br { display: none; }
  /* 这家没有报价就整行不出，别每家都挂一个「报价 —」 */
  .comparison-panel td[data-label="最近报价"].is-empty { display: none; }

  /* 录单表：纱名整行，色档与价格同一行 */
  .sheet-rows thead { display: none; }
  .sheet-rows, .sheet-rows tbody { display: block; }
  .sheet-rows tr { display: grid; grid-template-columns: minmax(0, 1fr) 6.2rem; gap: 6px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
  .sheet-rows td { display: block; padding: 0; width: auto; }
  .sheet-rows td:first-child { grid-column: 1 / -1; }
  .sheet-rows th.price-col, .sheet-rows td.price-col { width: auto; }
}

/* 录单表的价格格：全局 td:last-child{min-width:140px} 是给数据表的，这里是输入格，
   在 390px 屏上它把最后一格撑到 403px（2026-09-05 用 playwright 量出来的）。 */
.sheet-rows td:last-child { min-width: 0; }
.sheet-rows th.price-col, .sheet-rows td.price-col { width: 7rem; }
@media (max-width: 720px) {
  .sheet-rows tr { grid-template-columns: minmax(0, 1fr) 7rem; }
}
/* 首屏「现在标一下」的两组按钮长得不一样（一组方一组圆），统一成小药丸 */
.headline .tax-mark-row { align-items: center; }
.headline .tax-mark-item form button,
.headline .tax-mark-item button {
  min-height: 26px; padding: 0 10px; font-size: 12px; line-height: 1.7; border-radius: 999px;
  border: 1px solid #cfd8e3; background: #fff; color: #3d5570; box-shadow: none; font-weight: 500;
}
.headline .tax-mark-item button:hover { background: #f1f6f3; border-color: var(--green); }
@media (max-width: 720px) {
  /* 30% 是给三列表格的；变成两列网格后 30% 只剩 65px，色档框写不下「敏感色」 */
  .sheet-rows td.tier-col, .sheet-rows th.tier-col { width: auto; }
}

/* 卡片里保存后的一闪「已保存」。挂在 summary 右侧，1.6 秒后淡出；报错时红一点、多停一会。 */
.save-flash {
  margin-left: 10px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: #2f6b3a; background: #e8f5ea; opacity: 0; transition: opacity 200ms ease; vertical-align: middle;
}
.save-flash.is-on { opacity: 1; }
.save-flash.is-error { color: #8c3b3b; background: #fdecec; }

/* 保存反馈要出现在手指点的那个位置，不只在卡片标题旁。 */
.is-just-saved { background: #eef8f0; transition: background 300ms ease; border-radius: 8px; }
.row-saved { margin-left: 8px; color: #2f6b3a; font-size: 12px; font-weight: 600; white-space: nowrap; }
.price-note-row button[type="submit"]:disabled, .tax-points-row button[type="submit"]:disabled { opacity: .6; cursor: progress; }

/* 变价记录日期区间里的每个日期（只为不在「-」处折断而包的 span），别吃 td span 的灰色小字 */
td .when { color: inherit; font-size: inherit; }

/* 变价记录、成交记录、使用历史三张表：手机上不横拉。全局 table{min-width:720px} 让它们在
   375px 屏上要往右拖才看得到「涨跌」。窄屏改成按屏宽排、格子里折行。 */
@media (max-width: 720px) {
  table.fit-table { min-width: 0; }
  .fit-table th, .fit-table td { white-space: normal; padding: 8px 5px; font-size: 13px; }
  .fit-table td:last-child { min-width: 0; }
  .fit-table .tax-badge, .fit-table .trend-delta { white-space: nowrap; }
  /* 日期别从「-」处折断；变价记录的日期是区间，只在箭头处折 */
  .fit-table td:first-child, .fit-table .when, .fit-table th { white-space: nowrap; }
  .price-change-table.fit-table td:first-child { white-space: normal; }
  /* 使用历史的表在一张张小卡片里；卡片别被表撑出面板，真放不下就在卡片里横拉 */
  #usage .list-row { min-width: 0; }
}

/* 卡片里税点那行的「保存」原来是浏览器默认的小灰钮，和下面几行的「保存」长得不一样。 */
.tax-points-row button { min-height: 32px; border: 1px solid var(--line); border-radius: 6px; background: var(--green); color: #fff; padding: 0 11px; font-weight: 700; font-size: 12px; }

/* 手机上手指点得中（≥40px）：「现在标一下」的药丸、卡片里的「保存」。
   「录这家报价」是行内小字链接，用内边距撑大可点范围、负外边距抵掉，排版不变。 */
@media (max-width: 720px) {
  .headline .tax-mark-item form button,
  .headline .tax-mark-item button { min-height: 40px; padding: 0 14px; font-size: 13px; }
  .price-note-row select, .price-note-row input, .price-note-row button,
  .tax-points-row button { min-height: 40px; }
  .price-note-row button, .tax-points-row button { padding: 0 14px; font-size: 13px; }
  .comparison-panel td.cell-provider .row-action {
    position: relative; z-index: 1;
    padding: 12px 8px; margin: -12px -8px -12px -2px;
  }
  /* 「最近成交」放大到 18px 后右栏变宽；毛行名和「录这家报价」要能折行，
     不然全局 td{white-space:nowrap} 会让它们压到右栏的价格上。 */
  .comparison-panel td.cell-provider { white-space: normal; }
}
