:root {
  --ink: #18332f;
  --muted: #5e726d;
  --teal: #126b5c;
  --line: #dbe4df;
  --up: #a34532;
  --down: #197463;
  color: var(--ink);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #f4f7f4;
}
button,
input,
select {
  font: inherit;
}
button,
select,
a {
  touch-action: manipulation;
}
button,
a {
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: 0;
}
button:disabled {
  cursor: default;
  opacity: 0.42;
}
a {
  text-decoration: none;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #218975;
  outline-offset: 2px;
}
.shell {
  width: min(1480px, 94vw);
  margin: auto;
}
header {
  background: white;
  border-bottom: 1px solid var(--line);
}
.top {
  display: flex;
  align-items: center;
  height: 67px;
  gap: 46px;
}
.brand {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -1px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo {
  width: 34px;
  height: 34px;
  background: var(--ink);
  display: grid;
  place-items: center;
  border-radius: 9px;
}
.logo svg {
  width: 25px;
  stroke: #b9efbe;
  fill: none;
  stroke-width: 2.5;
  stroke-linejoin: round;
}
.top nav {
  display: flex;
  height: 100%;
  gap: 26px;
}
.top nav > * {
  display: grid;
  place-items: center;
  padding: 0 2px;
  color: var(--muted);
}
.top nav .active {
  color: var(--teal);
  font-weight: 650;
  border-bottom: 3px solid var(--teal);
}
.official {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}
.heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 32px 0 22px;
}
.agency {
  font-size: 13px;
  color: var(--teal);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
}
.agency i {
  width: 8px;
  height: 8px;
  background: #338c70;
  border-radius: 50%;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: clamp(29px, 3vw, 43px);
  letter-spacing: -1.6px;
  line-height: 1.25;
  margin-top: 8px;
}
h2 {
  font-size: 18px;
  letter-spacing: -0.4px;
}
.refresh {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--ink);
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
}
.refresh span {
  font-size: 19px;
}
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  background: #e9f1eb;
  border: 1px solid #d5e3d8;
  border-radius: 12px;
  margin-bottom: 22px;
  padding: 16px 0;
}
.stats > div {
  padding: 0 26px;
  display: flex;
  align-items: baseline;
  gap: 18px;
}
.stats > div + div {
  border-left: 1px solid #cddbd2;
}
.stats span,
small,
.code,
footer,
.pager {
  color: var(--muted);
  font-size: 12px;
}
.stats strong {
  font-size: 24px;
  letter-spacing: -0.8px;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.cardhead,
.tools,
.pager,
.dialoghead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.cardhead {
  padding: 21px 20px 14px;
}
.cardhead > div {
  display: flex;
  align-items: center;
  gap: 9px;
}
.accent {
  width: 4px;
  height: 17px;
  border-radius: 2px;
  background: #298a73;
}
.search {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 8px;
  background: #fafcfb;
}
.search svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
}
.search input {
  border: 0;
  background: none;
  min-width: 0;
  width: 155px;
  font-size: 13px;
}
.tools {
  justify-content: flex-start;
  overflow-x: auto;
  white-space: nowrap;
  padding: 0 20px 16px;
}
.segments {
  display: inline-flex;
  padding: 3px;
  background: #edf2ef;
  border-radius: 8px;
  gap: 3px;
}
.segments button {
  font-size: 12px;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 5px;
}
.segments button[aria-pressed="true"] {
  background: white;
  color: var(--teal);
  font-weight: bold;
  box-shadow: 0 1px 4px #163e321a;
}
.tablewrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
.list th,
.list td {
  text-align: right;
  padding: 11px 9px;
}
.list td {
  font-family: "Inter", system-ui, sans-serif;
}
.list th,
.history th {
  background: #f4f7f5;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.list th button {
  font: inherit;
  padding: 1px;
}
.list th button.sorted {
  color: var(--teal);
  font-weight: 700;
}
.list td {
  border-bottom: 1px solid #e9eeeb;
  white-space: nowrap;
}
.list th:first-child,
.list td:first-child {
  text-align: left;
  padding-left: 20px;
  white-space: normal;
}
.list th:last-child,
.list td:last-child {
  padding-right: 18px;
}
.list tr[data-code] {
  cursor: pointer;
}
.list tr[data-code]:hover {
  background: #f5f9f6;
}
.list tr.selected {
  background: #eaf5ef;
}
.list tr.selected td:first-child {
  box-shadow: inset 3px 0 #21866c;
}
.name {
  font-weight: 650;
  text-align: left;
  line-height: 1.45;
  padding: 0;
  font-size: 14px;
}
.code {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  display: block;
  letter-spacing: 0.3px;
  margin-top: 3px;
}
.pos {
  color: var(--up);
}
.neg {
  color: var(--down);
}
.null {
  color: #87948f;
}
.num {
  font-weight: 600;
}
.pager {
  padding: 12px 18px;
}
.pager > div {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pager button,
.dialoghead button {
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  font-size: 19px;
}
.link {
  color: var(--teal);
  font-size: 12px;
}
.details {
  scroll-margin: 12px;
}
.details:focus {
  outline: none;
}
.values {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  border-block: 1px solid var(--line);
  padding: 14px 0;
  margin: 17px 0;
}
.nav-values { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.other-rules { flex-basis: 100%; color: var(--muted); line-height: 1.5; }
.values label,
.chartbox label {
  font-size: 12px;
  color: var(--muted);
}
.values strong {
  display: block;
  font-size: clamp(13px, 2.9vw, 20px);
  overflow-wrap: anywhere;
  margin-top: 5px;
}
.chartbar,
.historytitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.chartbar select {
  font-size: 13px;
  max-width: 135px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: white;
  color: var(--ink);
  padding: 4px;
}
.chartbar .segments button {
  padding: 4px 7px;
  font-size: 11px;
}
.chart {
  width: 100%;
  height: 160px;
  display: block;
  margin-top: 10px;
  overflow: visible;
}
.chart text {
  font: 10px system-ui;
  fill: var(--muted);
}
.chartinfo {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: var(--muted);
  min-height: 17px;
}
.historytitle {
  margin: 20px 0 8px;
}
.historytitle h3 {
  font-size: 15px;
}
.history {
  font-size: 12px;
}
.history td,
.history th {
  padding: 8px 7px;
  text-align: right;
  border-bottom: 1px solid #e8eeeb;
}
.history td:first-child,
.history th:first-child {
  text-align: left;
}
.history th {
  font-size: 11px;
}
.history tr:last-child td {
  border: 0;
}
.empty {
  text-align: center !important;
  padding: 30px !important;
  color: var(--muted);
}
#status {
  padding: 10px 15px;
  background: #fff9e6;
  border: 1px solid #eadaae;
  border-radius: 8px;
  margin: 0 0 16px;
}
.footnote,
footer {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.65;
}
.footnote {
  margin-top: 10px;
}
footer {
  display: flex;
  justify-content: space-between;
  margin: 24px 0 30px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  width: min(590px, 94vw);
  color: var(--ink);
  padding: 22px;
  max-height: 84vh;
}
dialog::backdrop {
  background: #10292070;
}
.dialoghead {
  margin-bottom: 16px;
}
dialog p {
  line-height: 1.8;
  margin: 6px 0 14px;
}
dialog h3 {
  font-size: 15px;
}
@media (max-width: 1050px) {
  .stats > div {
    flex-direction: column;
    gap: 4px;
  }
  .list th,
  .list td {
    padding: 10px 6px;
  }
  .search input {
    width: 130px;
  }
}
@media (max-width: 780px) {
  .shell {
    width: min(95vw, 680px);
  }
  .top {
    gap: 18px;
    height: 56px;
  }
  .brand {
    font-size: 18px;
    gap: 6px;
  }
  .top nav {
    gap: 12px;
  }
  .top nav > * {
    font-size: 12px;
  }
  .official {
    font-size: 11px;
  }
  .heading {
    margin: 23px 2px 15px;
  }
  .stats {
    padding: 12px 0;
    margin-bottom: 12px;
  }
  .stats > div {
    padding: 0 12px;
  }
  .stats strong {
    font-size: 19px;
  }
  .stats span {
    font-size: 11px;
  }
  .cardhead {
    padding: 14px 12px;
  }
  .tools {
    padding: 0 12px 10px;
  }
  .list th:first-child,
  .list td:first-child {
    padding-left: 10px;
  }
  .list th:last-child,
  .list td:last-child {
    padding-right: 8px;
  }
  .list td {
    font-size: 12px;
  }
  .name {
    font-size: 13px;
  }
  .code {
    font-size: 9px;
    overflow-wrap: anywhere;
  }
  .list th,
  .list td {
    padding: 9px 4px;
  }
  .details {
    scroll-margin: 8px;
  }
  .refresh {
    padding: 7px 11px;
  }
  .chart {
    height: 180px;
  }
  .card {
    border-radius: 10px;
  }
  footer {
    display: block;
  }
  footer span {
    display: block;
  }
  .search input {
    width: 135px;
  }
  .pager {
    padding: 9px 12px;
  }
}
@media (max-width: 380px) {
  .official {
    display: none;
  }
  .stats strong {
    font-size: 16px;
  }
  .list th,
  .list td {
    padding-inline: 3px;
  }
  .search input {
    width: 118px;
  }
  .list th {
    font-size: 11px;
  }
}

.copy-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  width: 32px;
  height: 32px;
  color: var(--teal);
  border-radius: 5px;
}
.copy-code svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.copy-code:hover {
  background: #eaf5ef;
}
.copy-code .copied-symbol,
.copy-code.is-copied .copy-symbol {
  display: none;
}
.copy-code.is-copied .copied-symbol {
  display: inline;
}
@media (max-width: 480px) {
  .tools { gap: 6px; padding-inline: 8px; }
  .tools .segments { gap: 1px; padding: 2px; }
  .tools .segments button { padding: 7px 4px; }
}
.account-tools,
.banks,
.profile-actions,
.form-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}
.account-tools {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}
.account-btn,
.primary {
  background: var(--ink);
  color: white;
  border-radius: 7px;
  padding: 8px 15px;
}
.banks {
  margin: 22px 0 16px;
  gap: 6px;
  flex-wrap: wrap;
}
.banks button {
  padding: 7px 13px;
  border-radius: 7px;
  color: var(--muted);
}
.banks [aria-pressed="true"] {
  background: #dbece3;
  color: #145f4d;
  font-weight: 650;
}
.banks .reload {
  margin-left: auto;
}
#favorite[aria-pressed="true"] {
  background: #e9f4ec;
}
.pager:has(#pageIndex) {
  justify-content: flex-end;
}
.form-field {
  display: grid;
  gap: 6px;
  margin: 13px 0;
  font-size: 13px;
}
.form-field input {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 100%;
}
.form-note,
#accountMessage {
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0 0;
}
#accountDialog {
  width: min(450px, 94vw);
}
.profile-actions {
  flex-wrap: wrap;
}
.profile-actions button,
.user-list button,
.form-buttons button:not(.primary) {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.user-list {
  padding: 0;
  list-style: none;
}
.user-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  gap: 8px;
  padding: 9px 0;
}
.user-list small {
  display: block;
  margin-top: 3px;
}
.user-list button {
  font-size: 12px;
  margin-left: 4px;
}
@media (max-width: 650px) {
  .top {
    gap: 10px;
  }
  .account-tools {
    gap: 5px;
  }
  .account-btn {
    padding: 6px 9px;
  }
  .banks {
    gap: 1px;
    margin: 12px 0;
  }
  .banks button {
    font-size: 12px;
    padding: 6px 8px;
  }
  .account-tools #help {
    font-size: 11px;
    padding: 0;
  }
  .brand {
    font-size: 16px;
  }
  .top nav {
    gap: 7px;
  }
}

#catalogPage,
.detail-page {
  padding-bottom: 24px;
}
.detail-page {
  max-width: 900px;
  margin: 0 auto;
}
.back-to-list {
  display: inline-block;
  padding: 16px 0;
  color: var(--teal);
}
.detail-page .chart {
  height: auto;
  max-height: 310px;
}
.name:hover,
.back-to-list:hover {
  text-decoration: underline;
}

.product-title:not([hidden]) {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 16px 16px 0;
}
.product-title h2 {
  flex: 1;
  min-width: 0;
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
#favorite {
  width: 40px;
  height: 40px;
  margin: -5px -5px 0 0;
  flex-shrink: 0;
  border-radius: 8px;
  color: var(--muted);
}
#favorite svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; }
#favorite[aria-pressed="true"] { color: var(--teal); }
#favorite[aria-pressed="true"] svg { fill: currentColor; }
#detailBody { padding: 8px 16px 14px; }
.product-meta, .product-dates, .product-terms {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.product-meta { gap: 2px 0; }
.product-meta > span:not(:first-child)::before { content: "·"; margin: 0 6px; }
.product-code { color: var(--teal); }
.product-code .copy-code { width: 28px; height: 28px; }
.product-dates, .product-terms { margin-top: 4px; }
.trade-rule summary, .detail-sources summary { cursor: pointer; color: var(--teal); }
.trade-rule[open] { flex-basis: 100%; }
.trade-rule p { margin: 4px 0 0; }
.detail-sources { border-top: 1px solid var(--line); padding: 10px 16px; font-size: 12px; }
#sourceLinks { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 8px; }

@media (min-width: 960px) {
  #board {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    column-gap: clamp(14px, 1.6vw, 24px);
    align-items: start;
    padding-bottom: 24px;
  }
  #status, #banks { grid-column: 1 / -1; }
  #status { grid-row: 1; }
  #banks { grid-row: 2; }
  #catalogPage:not([hidden]) { display: contents; }
  .products { grid-column: 1; grid-row: 3; }
  #detail {
    grid-column: 2;
    grid-row: 3;
    position: sticky;
    top: 12px;
    width: 100%;
    max-width: none;
    max-height: calc(100vh - 24px);
    overflow: auto;
    padding-bottom: 0;
  }
  #backToList { display: none; }
}
