:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --text: #1d2433;
  --muted: #677085;
  --line: #d9deea;
  --accent: #0f766e;
  --accent-soft: #e4f5f2;
  --accent-line: #99d7cc;
  --error: #b91c1c;
  --error-soft: #fdecec;
  --shadow: 0 1px 2px rgb(17 24 39 / 8%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

main {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 720;
}

p {
  margin: 6px 0 0;
  color: var(--muted);
  max-width: 760px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: #eef1f6;
  padding: 1px 4px;
  border-radius: 4px;
}

.chain-status {
  min-width: 250px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.chain-status span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chain-status strong {
  display: block;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.banner {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 6px;
}

.banner.error {
  border: 1px solid #f3b4b4;
  background: var(--error-soft);
  color: var(--error);
}

.summary {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 16px;
  background: var(--panel);
  overflow: hidden;
}

.summary div {
  min-width: 0;
  padding: 11px 12px;
  border-right: 1px solid var(--line);
}

.summary div:last-child {
  border-right: 0;
}

.summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th.num,
td.num {
  text-align: right;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

thead th.sorted-asc::after {
  content: " \2191";
  color: var(--accent);
}

thead th.sorted-desc::after {
  content: " \2193";
  color: var(--accent);
}

tr.sec-row {
  cursor: pointer;
}

tr.sec-row:hover,
tr.sec-row.open {
  background: var(--accent-soft);
}

td.cusip {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
}

.flag {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--accent-line);
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 650;
}

tr.detail-row > td {
  padding: 14px 16px 18px;
  background: #fbfcfe;
  white-space: normal;
}

.auction-section h3 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.detail-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-top: 6px;
}

table.auctions {
  font-size: 13px;
}

table.auctions thead th {
  position: static;
  cursor: default;
}

table.auctions tbody tr:last-child td {
  border-bottom: none;
}

.bill-card {
  /* inline-size containment keeps the wide card content from stretching the
   * outer bills table; the auction table scrolls inside .detail-scroll. */
  contain: inline-size;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.bill-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.bill-card h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 720;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.bill-address {
  margin-top: 5px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.badge {
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.badge.warn {
  background: #ffedd5;
  color: #9a3412;
}

.economics {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1.2fr;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fcfb 0%, #ffffff 100%);
}

.econ-note {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: linear-gradient(180deg, #f8fcfb 0%, #ffffff 100%);
}

.econ-tile {
  min-width: 0;
}

.econ-tile span,
.accretion-head span,
.accretion-foot span,
.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.econ-tile strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.econ-tile em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
  font-style: normal;
}

.econ-tile.yield strong {
  color: var(--accent);
}

.econ-arrow {
  color: var(--muted);
  font-size: 22px;
  font-weight: 600;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.metric {
  min-width: 0;
  padding: 14px 18px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric[title] {
  cursor: help;
}

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.accretion {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fcfb 0%, #ffffff 100%);
}

.accretion-head {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.accretion-head div {
  min-width: 0;
}

.accretion-head strong {
  display: block;
  margin-top: 5px;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.progress-track {
  height: 10px;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
}

.progress-fill {
  height: 100%;
  min-width: 2px;
  background: var(--accent);
}

.accretion-foot {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.accretion-foot span {
  min-width: 0;
  overflow-wrap: anywhere;
  text-transform: none;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.auction-section {
  padding: 14px 18px 18px;
}

@media (max-width: 1100px) {
  .bill-header {
    display: block;
  }

  .badges {
    justify-content: flex-start;
    margin-top: 10px;
  }

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

  .econ-arrow {
    display: none;
  }

  .accretion-head,
  .accretion-foot {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    border-bottom: 1px solid var(--line);
  }
}

.soft {
  color: var(--muted);
  font-weight: 450;
  font-size: 12px;
}

.hint {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  max-width: none;
}

.footnote {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  max-width: 1000px;
}

@media (max-width: 1100px) {
  .summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
