:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --ink: #1a2233;
  --muted: #5d6b85;
  --line: #e3e8f2;
  --accent: #1f4fd8;
  --accent-soft: #e8eefc;
  --up: #0a7a3d;
  --up-soft: #e6f6ec;
  --future: #f0f7ff;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 30, 60, 0.08);
  font-size: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}

/* ── Header ─────────────────────────────────────────── */
.topbar {
  background: linear-gradient(120deg, #15306e, #1f4fd8);
  color: #fff;
  padding: 1.1rem 1.5rem;
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}


.brand h1 { margin: 0; font-size: 1.35rem; letter-spacing: 0.01em; }
.tagline { margin: 0.15rem 0 0; font-size: 0.85rem; opacity: 0.85; }
.badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  white-space: nowrap;
}
.badge.estimated { background: #b45309; border-color: #f59e0b; }
.badge.live { background: #047857; border-color: #34d399; }

/* ── Layout ─────────────────────────────────────────── */
.layout {
  max-width: 1280px;
  margin: 1.25rem auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 290px 1fr 380px;
  gap: 1rem;
  align-items: start;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-search, .panel-award { display: flex; flex-direction: column; max-height: calc(100vh - 180px); }
.panel-detail { position: sticky; top: 1rem; max-height: calc(100vh - 180px); overflow-y: auto; }

/* When an award is open the search panel collapses on narrow screens */
@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .panel-search.collapsed { display: none; }
  .panel-detail { position: static; max-height: none; }
}

/* ── Search panel ───────────────────────────────────── */
.searchbox { padding: 0.75rem; border-bottom: 1px solid var(--line); }
.searchbox input, .cls-controls input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}
.searchbox input:focus, .cls-controls input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.award-list { list-style: none; margin: 0; padding: 0.4rem; overflow-y: auto; }
.award-list li {
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
}
.award-list li:hover, .award-list li.active { background: var(--accent-soft); }
.award-list .code { font-size: 0.72rem; font-weight: 700; color: var(--accent); letter-spacing: 0.04em; }
.award-list .name { font-size: 0.88rem; font-weight: 550; }
.award-list .meta { font-size: 0.74rem; color: var(--muted); }
.award-list .empty { color: var(--muted); cursor: default; font-size: 0.85rem; }
.award-list .empty:hover { background: none; }

/* ── Award / classification panel ───────────────────── */
.award-header {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.9rem 1rem 0.6rem;
}
.back-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  font-size: 1rem;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  display: none;
}
@media (max-width: 1080px) { .back-btn { display: block; } }
.award-header h2 { margin: 0; font-size: 1.05rem; }
.muted { color: var(--muted); font-size: 0.8rem; margin: 0.15rem 0 0; }

.cls-controls {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  padding: 0 1rem 0.75rem;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.cls-controls input { flex: 1; min-width: 180px; }
.tabs { display: flex; gap: 0.3rem; }
.tabs button {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--muted);
}
.tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.cls-groups { overflow-y: auto; padding: 0.5rem 1rem 1rem; }
.cls-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 0.9rem 0 0.35rem;
}
.cls-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.cls-row:hover { background: var(--accent-soft); }
.cls-row.active { border-color: var(--accent); background: var(--accent-soft); }
.cls-row .cls-name { font-size: 0.88rem; font-weight: 530; }
.cls-row .cls-level { font-size: 0.72rem; color: var(--muted); }
.rate-chip {
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  white-space: nowrap;
  color: var(--muted);
}
.rate-chip .new { color: var(--up); font-weight: 650; }
.rate-chip .arrow { opacity: 0.55; margin: 0 0.2rem; }

/* ── Detail panel ───────────────────────────────────── */
.detail-empty { padding: 2rem 1.4rem; color: var(--muted); font-size: 0.9rem; }
.detail { padding: 1.1rem 1.2rem 1.4rem; }
.detail h3 { margin: 0 0 0.1rem; font-size: 1rem; }
.detail .crumb { font-size: 0.75rem; color: var(--muted); margin-bottom: 1rem; }

.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin: 0.75rem 0;
}
.rate-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
}
.rate-card.future-card { background: var(--future); border-color: #c8ddf5; }
.rate-card .label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.rate-card .big { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.rate-card .unit { font-size: 0.75rem; color: var(--muted); }
.rate-card .secondary { margin-top: 0.45rem; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.rate-card .dates { margin-top: 0.5rem; font-size: 0.7rem; color: var(--muted); }

.increase-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  background: var(--up-soft);
  border: 1px solid #bfe6cd;
  color: var(--up);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.increase-banner .pct { font-size: 1.1rem; }

.rate-type-section { margin-top: 1.25rem; }
.rate-type-section > h4 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.mini-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.mini-table th, .mini-table td { padding: 0.4rem 0.5rem; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.mini-table th:first-child, .mini-table td:first-child { text-align: left; }
.mini-table th { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.mini-table .delta { color: var(--up); font-weight: 600; }

.clause-note { margin-top: 1rem; font-size: 0.75rem; color: var(--muted); }

/* ── Footer ─────────────────────────────────────────── */
.disclaimer {
  max-width: 1280px;
  margin: 0 auto 2rem;
  padding: 0 1.5rem;
  color: var(--muted);
  font-size: 0.75rem;
}

/* ── Estimated (announced-AWR) rates ─────────────────── */
.rate-card.future-card.estimate-card { border: 1.5px dashed #f59e0b; background: #fffbeb; }
.est-pill {
  display: inline-block; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em;
  color: #92400e; background: #fef3c7; border: 1px solid #f59e0b; border-radius: 999px;
  padding: 0.05rem 0.45rem; margin-left: 0.4rem; vertical-align: middle;
}
.est-note { font-size: 0.72rem; color: #92400e; margin-top: 0.4rem; }

/* ── Unpriced MAPD entries (headers, annual/piece rates) ── */
.cls-row.unpriced .cls-name, .cls-row.unpriced .cls-level { color: #9ca3af; }
.rate-chip.unpriced-chip { color: #9ca3af; font-style: italic; font-weight: 400; }
.unpriced-note {
  color: #6b7280; background: #f9fafb; border: 1px dashed #d1d5db;
  border-radius: 8px; padding: 0.8rem 1rem; font-size: 0.85rem; margin: 0.75rem 0;
}

/* ── Classification context lines ────────────────────────────── */
/* Constrain the text column in the list row grid so long
   context labels truncate with ellipsis rather than overflowing */
.cls-row .cls-text { display: block; min-width: 0; overflow: hidden; }
.cls-row .cls-desc {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Detail panel: parent group eyebrow and stream label */
.detail .cls-parent {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.1rem;
}
.detail .cls-stream {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 0.1rem;
  margin-bottom: 0.75rem;
}
