:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-subtle: #f9fafb;
  --border: #d7dde7;
  --border-strong: #aab4c2;
  --text: #172033;
  --muted: #637083;
  --primary: #1f5fbf;
  --primary-strong: #174a96;
  --green: #16865a;
  --red: #c33a2b;
  --amber: #ad6b00;
  --purple: #6d45a8;
  --shadow: 0 10px 24px rgba(23, 32, 51, 0.08);
  --radius: 8px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 56px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.brand-link {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
}

.site-nav a {
  text-decoration: none;
}

.site-nav a:hover,
.brand-link:hover,
.dashboard-link:hover .dashboard-title {
  color: var(--primary);
}

.site-shell {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 48px;
}

.home-shell {
  max-width: 900px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}

.dashboard-heading {
  align-items: center;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 34px;
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: 0;
}

.heading-summary {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.directory-section,
.chart-section,
.table-section,
.detail-panel {
  margin-top: 22px;
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.count-pill,
.range-label {
  color: var(--muted);
  font-size: 13px;
}

.dashboard-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.dashboard-title,
.dashboard-subtitle,
.dashboard-status {
  display: block;
}

.dashboard-title {
  margin-bottom: 5px;
  font-weight: 700;
}

.dashboard-subtitle,
.dashboard-status {
  color: var(--muted);
  font-size: 13px;
}

.metadata-block {
  min-width: 220px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.metadata-block span,
.metric-tile span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metadata-block strong,
.metric-tile strong {
  display: block;
  font-size: 17px;
  line-height: 1.2;
}

.alert,
.loading-row,
.noscript-message {
  margin: 16px 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 14px;
}

.alert {
  border: 1px solid #f1b5ad;
  background: #fff2f0;
  color: #8c2117;
}

.loading-row,
.noscript-message {
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--muted);
}

[hidden] {
  display: none !important;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 26px;
}

.metric-tile {
  min-height: 84px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-primary {
  border-color: rgba(31, 95, 191, 0.45);
}

.chart-frame,
.table-frame,
.detail-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.chart-frame {
  min-height: 560px;
  padding: 10px;
}

.plotly-chart {
  width: 100%;
  height: 540px;
}

.details-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 18px;
  margin-top: 24px;
}

.detail-panel {
  padding: 18px;
}

.detail-panel h2 {
  margin-bottom: 14px;
}

.detail-list {
  margin: 0;
}

.detail-list div,
.source-row-item {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.detail-list div:first-child,
.source-row-item:first-child {
  border-top: 0;
  padding-top: 0;
}

dt,
.source-row-key {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

dd {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.source-row-value {
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  text-align: right;
}

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

.data-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

.data-table th:first-child,
.data-table td:first-child {
  text-align: left;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.number-cell {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

.neutral {
  color: var(--muted);
}

@media (max-width: 900px) {
  .site-header,
  .page-heading,
  .section-heading-row,
  .dashboard-link {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-header {
    padding: 14px 20px;
  }

  .site-shell {
    width: min(100% - 28px, 1240px);
    padding-top: 22px;
  }

  h1 {
    font-size: 28px;
  }

  .metadata-block {
    width: 100%;
  }

  .metric-grid,
  .details-grid {
    grid-template-columns: 1fr;
  }

  .chart-frame {
    min-height: 430px;
  }

  .plotly-chart {
    height: 410px;
  }

  .detail-list div,
  .source-row-item {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .source-row-value {
    text-align: left;
  }
}
.dashboard-list {
  display: grid;
  gap: 12px;
}

.explorer-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.control-panel {
  position: sticky;
  top: 76px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.compact-heading-row {
  margin-bottom: 16px;
}

.form-field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.form-field span,
.checkbox-group legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.form-field select,
.form-field input,
.category-select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.form-field input {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.form-field select:focus,
.form-field input:focus,
.category-select:focus,
.secondary-button:focus {
  outline: 2px solid rgba(31, 95, 191, 0.28);
  outline-offset: 2px;
}

.control-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.checkbox-group {
  margin: 0 0 15px;
  padding: 13px 0 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.checkbox-group legend {
  padding: 0 8px 0 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  color: var(--text);
  font-size: 14px;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

.category-group {
  margin-bottom: 12px;
}

.category-search-field {
  margin: 10px 0 0;
}

.category-search-field input {
  font-family: inherit;
  font-variant-numeric: normal;
}

.category-select {
  min-height: 260px;
  margin-top: 8px;
  font-size: 13px;
}

.category-select:disabled {
  background: var(--surface-subtle);
  color: var(--muted);
}

.control-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.category-feedback-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 9px;
}

.category-feedback-row .control-help {
  margin: 0;
}

.category-clear-button {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
  white-space: nowrap;
}

.category-clear-button:disabled,
.category-clear-button:disabled:hover {
  color: var(--muted);
  border-color: var(--border);
  cursor: not-allowed;
}

.category-selection-list {
  display: grid;
  gap: 6px;
  max-height: 150px;
  margin-top: 8px;
  overflow: auto;
}

.category-selection-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
  align-items: start;
  padding: 6px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-subtle);
  font-size: 12px;
}

.category-selection-item-muted {
  opacity: 0.68;
}

.category-selection-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.category-selection-status {
  color: var(--muted);
  white-space: normal;
}

.button-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.secondary-button {
  min-height: 36px;
  padding: 7px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.explorer-main {
  min-width: 0;
}

.explorer-chart-section {
  margin-top: 0;
}

.tga-chart-frame,
.securities-chart-frame {
  min-height: 630px;
}

.tga-chart,
.securities-chart {
  height: 610px;
}

.guardrail-message,
.diagnostics-bar {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
}

.guardrail-message {
  border: 1px solid #e6c37a;
  background: #fff8e8;
  color: #684000;
}

.diagnostics-bar {
  margin: 12px 0 0;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  overflow-x: auto;
  white-space: nowrap;
}

.explorer-details {
  margin-top: 18px;
}

@media (max-width: 1050px) {
  .explorer-layout {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }
}

@media (max-width: 900px) {
  .control-pair {
    grid-template-columns: 1fr;
  }

  .tga-chart-frame,
  .securities-chart-frame {
    min-height: 460px;
  }

  .tga-chart,
  .securities-chart {
    height: 440px;
  }
}
.chart-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.chart-expand-button,
.chart-expand-action,
.chart-expand-restore {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.chart-expand-button:hover,
.chart-expand-action:hover,
.chart-expand-restore:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.chart-expand-button:focus,
.chart-expand-action:focus,
.chart-expand-restore:focus {
  outline: 2px solid rgba(31, 95, 191, 0.28);
  outline-offset: 2px;
}

.chart-expand-header {
  display: none;
}

.chart-expand-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
  flex-wrap: wrap;
}

body.chart-expanded-active {
  overflow: hidden;
}

.chart-frame.is-chart-expanded {
  position: fixed;
  inset: 12px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.chart-frame.is-chart-expanded .chart-expand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.chart-expand-title-block {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.chart-expand-title {
  font-size: 15px;
  line-height: 1.2;
}

.chart-expand-meta {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-frame.is-chart-expanded .plotly-chart {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}

@media (max-width: 900px) {
  .chart-heading-actions {
    justify-content: flex-start;
  }

  .chart-frame.is-chart-expanded {
    inset: 0;
    border-radius: 0;
  }

  .chart-frame.is-chart-expanded .chart-expand-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .chart-expand-actions {
    width: 100%;
  }

  .chart-expand-action,
  .chart-expand-restore {
    flex: 1 1 150px;
  }
}

.tga-top-layout {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.tga-top-control-strip {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tga-top-control-heading {
  display: grid;
  gap: 4px;
  min-width: 150px;
}

.tga-top-control-heading h2 {
  margin: 0;
}

.tga-top-date-field {
  width: 190px;
  margin-bottom: 0;
}

.tga-top-control-strip .control-help {
  flex: 1 1 260px;
  min-width: 220px;
  margin: 0;
}

.tga-top-date-buttons {
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 0;
}

.tga-top-table-grid,
.tga-top-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.tga-top-chart-grid {
  margin-top: 18px;
}

.tga-top-table-panel,
.tga-top-chart-section {
  margin-top: 0;
}

.tga-top-table-panel .table-frame {
  max-height: 430px;
  overflow: auto;
}

.tga-top-table {
  min-width: 560px;
}

.tga-top-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border);
}

.tga-top-table th:first-child,
.tga-top-table td:first-child {
  min-width: 240px;
  white-space: normal;
}

.tga-top-empty {
  margin: 0;
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
}

.tga-top-pie-frame {
  min-height: 520px;
}

.tga-top-pie-chart {
  height: 500px;
}

@media (max-width: 1050px) {
  .tga-top-table-grid,
  .tga-top-chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .tga-top-pie-frame {
    min-height: 440px;
  }

  .tga-top-pie-chart {
    height: 420px;
  }
}

.report-shell {
  width: min(1500px, calc(100% - 40px));
}

.report-table-section {
  margin-top: 20px;
}

.issued-maturing-table-frame {
  max-height: calc(100vh - 260px);
  min-height: 520px;
  overflow: auto;
}

.issued-maturing-table {
  width: max-content;
  min-width: 100%;
  font-size: 12px;
}

.issued-maturing-table th,
.issued-maturing-table td {
  padding: 9px 10px;
}

.issued-maturing-table thead th {
  position: sticky;
  z-index: 2;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border);
}

.issued-maturing-table thead tr:first-child th {
  top: 0;
  z-index: 4;
}

.issued-maturing-table thead tr:nth-child(2) th {
  top: 34px;
  z-index: 3;
}

.issued-maturing-table .group-header {
  color: var(--text);
  text-align: center;
}

.issued-maturing-table .collapsible-group-header {
  padding: 0;
}

.issued-maturing-table .group-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  box-sizing: border-box;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 800;
  gap: 8px;
  justify-content: center;
  min-height: 34px;
  padding: 9px 10px;
  text-transform: uppercase;
  width: 100%;
}

.issued-maturing-table .group-toggle:hover {
  background: #f1f5f9;
}

.issued-maturing-table .group-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.issued-maturing-table .group-toggle-symbol {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1;
}

.issued-maturing-table.group-collapsed-bills [data-group="bills"].collapsible-extra,
.issued-maturing-table.group-collapsed-notes [data-group="notes"].collapsible-extra,
.issued-maturing-table.group-collapsed-bonds [data-group="bonds"].collapsible-extra {
  display: none;
}

.issued-maturing-table.group-collapsed-bills [data-group="bills"].group-summary,
.issued-maturing-table.group-collapsed-notes [data-group="notes"].group-summary,
.issued-maturing-table.group-collapsed-bonds [data-group="bonds"].group-summary {
  border-left: 2px solid var(--border-strong);
}

.issued-maturing-table .group-start {
  border-left: 2px solid var(--border-strong);
}

.issued-maturing-table .sticky-column {
  position: sticky;
  left: 0;
  z-index: 5;
  min-width: 112px;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--border);
}

.issued-maturing-table tbody .sticky-column {
  z-index: 1;
  background: var(--issued-maturing-row-bg);
}

.issued-maturing-table tbody tr {
  --issued-maturing-row-bg: var(--surface);
}

.issued-maturing-table tbody tr:nth-child(even) {
  --issued-maturing-row-bg: #f8fafc;
}

.issued-maturing-table tbody tr:hover {
  --issued-maturing-row-bg: #eef5ff;
}

.issued-maturing-table tbody td {
  background: var(--issued-maturing-row-bg);
}

.issued-maturing-table .date-cell {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.issued-maturing-table .auction-marker-cell {
  color: var(--primary-strong);
  font-family: var(--mono);
  font-weight: 800;
  text-align: center;
}

@media (max-width: 900px) {
  .report-shell {
    width: min(100% - 28px, 1500px);
  }

  .issued-maturing-table-frame {
    max-height: 70vh;
    min-height: 430px;
  }
}
