:root {
  --navy: #17365d;
  --teal: #0f766e;
  --ink: #17202a;
  --muted: #667085;
  --pale: #f3f6fa;
  --line: #d8dee8;
  --blue: #2563eb;
  --gold: #b7791f;
  --red: #a12d2d;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Arial, sans-serif; color: var(--ink); background: var(--pale); }
header { background: var(--navy); color: white; padding: 24px 32px; display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
h1, h2, p { margin: 0; }
header h1 { font-size: 28px; }
header p { margin-top: 6px; color: #d7e3f1; }
.version-line { font-size: 12px; font-weight: 800; color: #a7f3d0; }
a { color: var(--blue); }
.status { color: #6ee7d8; font-weight: 800; }
.status.amber { color: #fbbf24; }
.status.red { color: #f87171; }
.tabs { display: flex; gap: 8px; padding: 12px 22px 0; background: var(--pale); }
button { border: 0; background: var(--teal); color: white; border-radius: 12px; padding: 10px 16px; font: inherit; font-weight: 800; cursor: pointer; }
.tabs button, .ranges button, .segmented button { background: white; color: var(--navy); }
.tabs button.active, .ranges button.active, .segmented button.active { background: var(--navy); color: white; }
main { padding: 18px 22px 28px; }
.panel { display: none; }
.panel.active { display: block; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stats div, .card, .source-pill { background: white; border-radius: 14px; box-shadow: 0 1px 2px rgba(16, 41, 71, .08); }
.stats div { padding: 12px 14px; }
.stats span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 3px; font-weight: 700; }
.stats strong { font-size: 17px; }
.stats small { display: block; color: var(--muted); margin-top: 3px; }
.workspace { display: grid; grid-template-columns: minmax(640px, 1fr) 370px; gap: 18px; }
.card { padding: 18px; }
.chart-card { position: relative; }
.card-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.card h2 { font-size: 20px; }
.card p { color: var(--muted); font-size: 13px; margin-top: 5px; }
.toggles { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.toggles label, .inline { flex-direction: row; color: var(--ink); font-size: 13px; align-items: center; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 800; margin-top: 12px; }
input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: white; font: inherit; }
input[type="range"] { padding: 0; accent-color: var(--teal); }
canvas { width: 100%; height: 460px; display: block; }
#bondChart { height: 520px; }
.ranges { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 18px 0; }
.bond-toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 16px; }
.segmented { display: flex; gap: 8px; }
.source-pill { padding: 10px 14px; color: var(--navy); font-weight: 800; }
.hover-tip { position: absolute; z-index: 5; min-width: 220px; pointer-events: none; background: rgba(17, 24, 39, .94); color: white; border-radius: 10px; padding: 9px 10px; box-shadow: 0 8px 18px rgba(17, 24, 39, .22); font-size: 12px; line-height: 1.45; }
.hover-tip strong { display: block; margin-bottom: 4px; }
.hover-tip span { display: flex; justify-content: space-between; gap: 18px; }
.hover-tip em { font-style: normal; color: #a7f3d0; }
.hover-holdings { margin-top: 7px; padding-top: 7px; border-top: 1px solid rgba(255, 255, 255, .22); }
.hover-holdings small { display: block; color: #cbd5e1; font-size: 11px; margin-bottom: 4px; }
.hidden { display: none; }
.table-wrap { margin-top: 18px; padding: 0; overflow: auto; max-height: 280px; }
.holdings-card { margin-top: 18px; overflow: auto; }
.holdings-card .source-pill { white-space: nowrap; }
.holdings-card table td:nth-child(3), .holdings-card table th:nth-child(3) { font-weight: 900; color: var(--teal); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { position: sticky; top: 0; background: var(--navy); color: white; text-align: left; padding: 9px 10px; }
td { border-bottom: 1px solid var(--line); padding: 8px 10px; white-space: nowrap; }
.data-card p { margin-top: 10px; }
.health-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: #d1fae5;
  color: #065f46;
  font-weight: 900;
}
.health-badge.amber { background: #fef3c7; color: #92400e; }
.health-badge.red { background: #fee2e2; color: #991b1b; }
.health-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.health-grid div {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #fbfdff;
}
.health-grid span, .health-grid small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.health-grid strong {
  display: block;
  font-size: 18px;
  margin: 5px 0;
}
@media (max-width: 1000px) {
  header, .bond-toolbar { flex-direction: column; }
  .stats, .workspace, .health-grid { grid-template-columns: 1fr; }
}
