body {
  margin: 0;
  color: #1f2933;
  background: #f5f7fa;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px;
}
.narrow {
  max-width: 720px;
}
.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}
h1 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 700;
}
.description {
  max-width: 760px;
  margin: 0 0 8px;
  color: #334155;
  font-size: 14px;
  line-height: 1.5;
}
.meta {
  margin: 0;
  color: #64748b;
}
a {
  color: #0f5e9c;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
.links {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}
.links a,
.topbar nav a {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 12px;
  background: #fff;
}
.table-shell {
  margin-top: 22px;
  overflow: auto;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  background: #fff;
}
table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}
.archive table {
  min-width: 0;
  table-layout: fixed;
}
.archive {
  max-width: 900px;
}
.archive-date {
  width: 26%;
}
.archive-count {
  width: 17%;
}
.archive-ratio {
  width: 40%;
}
th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid #e6edf3;
  text-align: left;
  white-space: nowrap;
  font-size: 13px;
}
.archive th,
.archive td {
  text-align: center;
}
.temperature-legend {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  max-width: 720px;
  margin-top: 14px;
}
.temperature-title {
  padding-top: 20px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.temperature-key {
  flex: 1;
  min-width: 360px;
}
.temperature-labels {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 5px;
  color: #52606d;
  font-size: 12px;
}
.temperature-labels span:nth-child(2) {
  text-align: center;
}
.temperature-labels span:last-child {
  text-align: right;
}
.temperature-scale {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb 0%, #06b6d4 25%, #eab308 50%, #f97316 75%, #dc2626 100%);
  box-shadow: inset 0 0 0 1px rgb(15 23 42 / 12%);
}
.sentiment-chart {
  display: block;
  width: 100%;
  height: 82px;
  margin-top: 8px;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  background: #fff;
}
.ratio-temperature {
  display: inline-block;
  min-width: 54px;
  padding: 5px 9px;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px rgb(15 23 42 / 10%);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.ratio-empty {
  color: #8a94a3;
}
@media (max-width: 640px) {
  .temperature-legend {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }
  .temperature-title {
    padding-top: 0;
  }
  .temperature-key {
    min-width: 0;
  }
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #334155;
  background: #eef3f8;
}
#stock-table th {
  cursor: pointer;
  user-select: none;
}
#stock-table th::after {
  content: " ↕";
  color: #8796a8;
  font-size: 11px;
}
#stock-table td:nth-child(1),
#stock-table td:nth-child(4),
#stock-table td:nth-child(5),
#stock-table td:nth-child(6),
#stock-table td:nth-child(7),
#stock-table td:nth-child(8),
#stock-table td:nth-child(9),
#stock-table td:nth-child(13) {
  text-align: right;
}
tbody tr:hover {
  background: #f8fafc;
}
.detail-toolbar {
  display: none;
}
@media (max-width: 720px) {
  .wrap {
    padding: 14px 12px;
  }
  h1 {
    font-size: 23px;
  }
  .description {
    font-size: 13px;
  }
  .topbar {
    align-items: start;
    flex-direction: column;
    gap: 12px;
  }
  .links {
    flex-wrap: wrap;
    margin-top: 18px;
  }
  .archive {
    margin-top: 16px;
    overflow: hidden;
  }
  .archive-date {
    width: 30%;
  }
  .archive-count {
    width: 16%;
  }
  .archive-ratio {
    width: 38%;
  }
  .archive th,
  .archive td {
    padding: 8px 4px;
    font-size: 12px;
  }
  .archive th:last-child {
    font-size: 0;
  }
  .archive th:last-child::after {
    content: "Ratio";
    font-size: 12px;
  }
  .ratio-temperature {
    min-width: 44px;
    padding: 4px 6px;
  }
  .detail-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
  }
  .view-switch {
    display: inline-flex;
    align-items: center;
    flex: none;
    gap: 3px;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
  }
  .view-switch button {
    border: 1px solid #cbd5e1;
    padding: 5px 8px;
    color: #334155;
    background: #fff;
    font: inherit;
    text-transform: none;
  }
  .view-switch button:first-of-type {
    border-radius: 5px 0 0 5px;
  }
  .view-switch button:last-child {
    border-radius: 0 5px 5px 0;
  }
  .view-switch button[aria-pressed="true"] {
    border-color: #0f5e9c;
    color: #fff;
    background: #0f5e9c;
  }
  .scroll-hint {
    color: #64748b;
    font-size: 11px;
    text-align: right;
  }
  .stock-table-shell {
    margin-top: 8px;
    -webkit-overflow-scrolling: touch;
  }
  #stock-table th,
  #stock-table td {
    padding: 7px 8px;
    font-size: 12px;
  }

  /* Table view is the mobile default so rows remain easy to compare. The
     optional card view favors reading one stock at a time. */
  .stock-table-shell.card-view {
    overflow: visible;
    border: 0;
    background: transparent;
  }
  .card-view #stock-table {
    display: block;
    min-width: 0;
  }
  .card-view #stock-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .card-view #stock-table tbody {
    display: grid;
    gap: 12px;
  }
  .card-view #stock-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 8px;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 2px rgb(15 23 42 / 5%);
  }
  .card-view #stock-table td {
    display: flex;
    min-width: 0;
    padding: 6px;
    border: 0;
    flex-direction: column;
    gap: 2px;
    overflow-wrap: anywhere;
    text-align: left;
    white-space: normal;
  }
  .card-view #stock-table td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-transform: uppercase;
  }
  .card-view #stock-table td:nth-child(3) {
    grid-column: 1 / -1;
  }
  .card-view #stock-table td:nth-child(2) a {
    font-size: 16px;
    font-weight: 700;
  }
  .card-view #stock-table td:nth-child(1),
  .card-view #stock-table td:nth-child(4),
  .card-view #stock-table td:nth-child(5),
  .card-view #stock-table td:nth-child(6),
  .card-view #stock-table td:nth-child(7),
  .card-view #stock-table td:nth-child(8),
  .card-view #stock-table td:nth-child(9),
  .card-view #stock-table td:nth-child(13) {
    text-align: left;
  }
}
