:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Noto Sans TC", "Segoe UI", sans-serif;
  background: #f2f4f7;
  color: #18202a;
  line-height: 1.4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f2f4f7;
  color: #18202a;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: #ffffff;
  border-bottom: 1px solid #d9e0e7;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.language-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(42px, 1fr));
  border: 1px solid #d9e0e7;
  border-radius: 7px;
  padding: 2px;
  background: #f6f8fa;
}

.language-option {
  min-height: 34px;
  border: 0;
  border-radius: 5px;
  padding: 0 9px;
  background: transparent;
  color: #5d6773;
  font-size: 13px;
}

.language-option.is-active {
  background: #ffffff;
  color: #18202a;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.12);
}

.language-option:hover {
  background: #ffffff;
}

.header-copy {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.1;
  font-weight: 780;
}

.inline-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-left: 3px solid #aeb7c2;
  padding: 3px 0 3px 9px;
  color: #6c7580;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
}

h2 {
  font-size: 17px;
  line-height: 1.2;
}

button {
  min-height: 40px;
  border: 1px solid #2f6f65;
  border-radius: 6px;
  padding: 0 14px;
  background: #2f6f65;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: #275d55;
}

main {
  display: grid;
  gap: 14px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px;
}

section {
  background: #ffffff;
  border: 1px solid #d9e0e7;
  border-radius: 8px;
  padding: 16px;
}

.detail-section {
  background: #ffffff;
  border: 1px solid #d9e0e7;
  border-radius: 8px;
  padding: 16px;
}

.detail-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: #18202a;
  font-size: 17px;
  line-height: 1.2;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.detail-section summary::-webkit-details-marker {
  display: none;
}

.detail-section summary::after {
  content: "▾";
  color: #6c7580;
  font-size: 22px;
  line-height: 1;
  padding-left: 8px;
  transition: transform 160ms ease;
}

.detail-section:not([open]) summary {
  margin-bottom: 0;
}

.detail-section:not([open]) summary::after {
  transform: rotate(-90deg);
}

.section-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.section-heading.compact {
  margin-bottom: 10px;
}

.section-heading p {
  color: #5d6773;
  font-size: 13px;
}

.primary-overview {
  padding: 16px;
}

.primary-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.primary-card {
  display: grid;
  gap: 14px;
  min-height: 288px;
  border: 1px solid #d9e0e7;
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.primary-card-head {
  display: block;
  min-width: 0;
}

.primary-card h3 {
  color: #18202a;
  font-size: 22px;
  line-height: 1.2;
}

.primary-card h3 a {
  color: inherit;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.primary-card h3 a:hover {
  color: #0f5f8f;
}

.primary-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.card-metric {
  display: grid;
  gap: 5px;
  min-height: 82px;
  border: 1px solid #e5e9ee;
  border-radius: 7px;
  padding: 10px;
  background: #ffffff;
}

.broker-notes {
  display: grid;
  gap: 8px;
  border-top: 1px solid #e5e9ee;
  padding-top: 10px;
}

.broker-notes-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.broker-notes-head span {
  color: #5d6773;
  font-size: 12px;
  font-weight: 750;
}

.broker-notes-head strong {
  color: #18202a;
  font-size: 14px;
  text-align: right;
}

.broker-notes ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
  color: #354253;
  font-size: 12px;
}

.broker-source {
  color: #6c7580;
  font-size: 11px;
}

.metric-label {
  color: #5d6773;
  font-size: 12px;
  font-weight: 700;
}

.card-metric strong {
  font-size: 20px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.metric-meta {
  color: #5d6773;
  font-size: 11px;
}

.asia-summary-section {
  padding: 14px 16px;
}

.asia-summary-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.europe-list .asia-pill {
  min-width: 132px;
}

.asia-pill {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 148px;
  border: 1px solid #d9e0e7;
  border-radius: 8px;
  padding: 9px 11px;
  background: #fbfcfd;
  color: #18202a;
  text-decoration: none;
}

.asia-pill strong {
  font-size: 15px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #e5e9ee;
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

thead th {
  color: #5d6773;
  font-size: 12px;
}

tbody th {
  width: 180px;
  min-width: 180px;
  color: #19212b;
  font-size: 14px;
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

.rate-value {
  font-size: 16px;
  font-weight: 800;
  word-break: break-word;
}

.rate-tone {
  color: #19212b;
}

[data-rate-tone="low"] {
}

[data-rate-tone="low"] .rate-tone {
  color: #15803d;
}

[data-rate-tone="moderate"] {
}

[data-rate-tone="moderate"] .rate-tone {
  color: #65a30d;
}

[data-rate-tone="mid"] {
}

[data-rate-tone="mid"] .rate-tone {
  color: #d97706;
}

[data-rate-tone="high"] {
}

[data-rate-tone="high"] .rate-tone {
  color: #dc2626;
}

[data-rate-tone="very-high"] {
}

[data-rate-tone="very-high"] .rate-tone {
  color: #991b1b;
}

[data-rate-tone="unknown"] {
}

.cell-stack {
  display: grid;
  gap: 6px;
}

.cell-meta {
  color: #5d6773;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.quality-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.quality {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 7px;
  background: #eef2ef;
  color: #32433f;
  font-size: 11px;
  font-weight: 700;
}

.stale-flag {
  color: #a35a14;
  font-size: 11px;
  font-weight: 700;
}

.note {
  color: #6d4c41;
}

a {
  color: #0f5f8f;
}

.chart {
  min-height: 220px;
  border: 1px solid #e5e9ee;
  border-radius: 6px;
  background: #fbfcfd;
  padding: 16px;
}

.chart-caption {
  margin-bottom: 10px;
  color: #5d6773;
  font-size: 13px;
}

.chart-empty {
  display: flex;
  align-items: center;
  min-height: 180px;
  color: #5d6773;
  font-size: 14px;
}

.trend-svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-grid {
  stroke: #d6dde5;
  stroke-width: 1;
}

.chart-axis-label {
  fill: #5d6773;
  font-size: 12px;
}

.chart-legend-label {
  fill: #19212b;
  font-size: 12px;
  font-weight: 700;
}

.page-footer {
  display: grid;
  gap: 8px;
  padding: 4px 2px 14px;
  color: #6c7580;
  font-size: 12px;
}

.quality-note {
  max-width: 980px;
}

.credit {
  color: #4d5865;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 720px) {
  body {
    background: #f6f8fa;
  }

  .page-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    padding: 14px;
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .page-header button {
    width: auto;
  }

  .header-actions {
    justify-self: end;
    display: grid;
    grid-template-columns: auto 92px;
    gap: 8px;
  }

  .language-toggle {
    width: 92px;
    grid-template-columns: repeat(2, 1fr);
  }

  #refreshButton {
    min-width: 52px;
    min-height: 40px;
    padding: 0 11px;
  }

  h1 {
    font-size: 22px;
  }

  .header-copy {
    display: grid;
    gap: 5px;
  }

  .inline-status {
    min-height: 22px;
    border-left: 0;
    padding: 0;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  main {
    gap: 10px;
    padding: 10px 8px 16px;
  }

  section {
    border-radius: 7px;
    padding: 12px;
  }

  .detail-section {
    border-radius: 7px;
    padding: 12px;
  }

  .detail-section summary {
    margin-bottom: 0;
    min-height: 28px;
  }

  .detail-section[open] summary {
    margin-bottom: 10px;
  }

  .primary-overview {
    padding: 12px;
  }

  .primary-card-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .primary-card {
    min-height: auto;
    gap: 12px;
    padding: 14px;
    background: #ffffff;
    min-width: 0;
  }

  .primary-card h3 {
    font-size: 22px;
  }

  .primary-metrics {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .card-metric {
    min-height: 86px;
    padding: 10px;
  }

  .card-metric strong {
    font-size: 20px;
  }

  .broker-notes {
    gap: 7px;
  }

  .broker-notes-head {
    align-items: flex-start;
  }

  .broker-notes ul {
    font-size: 12px;
    line-height: 1.45;
  }

  .asia-summary-section {
    padding: 12px;
  }

  .asia-summary-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .asia-pill {
    width: 100%;
    min-width: 0;
    gap: 8px;
    padding: 9px;
  }

  .asia-pill strong {
    font-size: 14px;
  }

  .chart {
    min-height: 190px;
    padding: 10px;
    overflow-x: hidden;
  }

  .trend-svg {
    width: 100%;
    min-width: 0;
  }

  .table-wrap {
    overflow-x: visible;
  }

  table {
    min-width: 0;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody tr {
    display: grid;
    gap: 8px;
    border-bottom: 1px solid #e5e9ee;
    padding: 10px 0;
  }

  tbody th {
    width: 100%;
    min-width: 0;
    padding: 0;
    border-bottom: 0;
    font-size: 16px;
  }

  td {
    border: 1px solid #e5e9ee;
    border-radius: 7px;
    padding: 10px;
  }

  td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 6px;
    color: #5d6773;
    font-size: 12px;
    font-weight: 750;
  }

  .page-footer {
    text-align: center;
    padding: 8px 10px 18px;
  }

  .quality-note {
    max-width: none;
    line-height: 1.5;
  }
}

@media (max-width: 390px) {
  .asia-summary-list {
    grid-template-columns: 1fr;
  }
}
