/* Predictions page only. Loaded last, unlayered, so these rules beat the
   layered legacy sheets (including @layer screens) without !important.
   Every selector is scoped to body.route-predictions. Other routes are untouched.

   Palette is the sidebar ramp. #2196F3 is the Model Lab link only.
   Weights are Satoshi 400 / 500 / 700. 700 is the detail title. */

html body.route-predictions {
  --pred-canvas: #171818;
  --pred-page: #1A1B1B;
  --pred-card: #1F2121;
  --pred-raised: #252727;
  --pred-hover: #2B2D2D;
  --pred-border: #2F3232;
  --pred-border-strong: #3B3E3E;
  --pred-text: #ECEDEC;
  --pred-text-2: #A6ABAB;
  --pred-text-3: #7A7F7F;
  --pred-accent: #2196F3;
}

html body.route-predictions #main,
html body.route-predictions #main-content,
html body.route-predictions .main-content {
  background: var(--pred-page);
  color: var(--pred-text);
}

html body.route-predictions .predictions-view,
html body.route-predictions .predictions-detail:not(.pred-math-lab) {
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 24px 32px;
  color: var(--pred-text);
  font-size: 14px;
  font-weight: 400;
  background: transparent;
}

/* On this route the sidebar active row is a neutral fill, and the plan
   label is plain tertiary text. Other routes keep their own sidebar. */
html body.route-predictions aside.sidebar#sidebar .sidebar-quick-item.active {
  background: var(--pred-hover);
  background-image: none;
  color: var(--pred-text);
  box-shadow: none;
}

html body.route-predictions aside.sidebar#sidebar .sidebar-quick-item.active .sqi-icon,
html body.route-predictions aside.sidebar#sidebar .sidebar-quick-item.active .sqi-label {
  background: transparent;
  background-image: none;
  color: var(--pred-text);
  stroke: currentColor;
  font-weight: 500;
}

html body.route-predictions .footer-org-tier-badge {
  background: transparent;
  background-image: none;
  color: var(--pred-text-3);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  height: auto;
  padding: 0;
  opacity: 1;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

html body.route-predictions .predictions-toolbar--solo {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0 0 16px;
}

html body.route-predictions .predictions-toolbar--solo .pred-tool {
  height: 32px;
  padding: 0 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  background-image: none;
  box-shadow: none;
  color: var(--pred-text-2);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

html body.route-predictions .predictions-toolbar--solo > .pred-tool:first-child {
  color: var(--pred-accent);
}

html body.route-predictions .predictions-toolbar--solo .pred-tool:hover {
  background: var(--pred-hover);
  border: 0;
  color: var(--pred-text);
}

html body.route-predictions .predictions-toolbar--solo > .pred-tool:first-child:hover {
  color: var(--pred-accent);
}

html body.route-predictions .pred-section + .pred-section {
  margin-top: 32px;
}

html body.route-predictions .pred-section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
}

html body.route-predictions .pred-section-title {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--pred-text);
}

html body.route-predictions .pred-section-blurb {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--pred-text-2);
}

html body.route-predictions .pred-grid {
  gap: 16px;
}

html body.route-predictions .pred-card {
  background: var(--pred-card);
  background-image: none;
  border: 1px solid var(--pred-border);
  border-radius: 10px;
  box-shadow: none;
  padding: 20px;
  color: var(--pred-text);
  min-width: 0;
}

html body.route-predictions .pred-card:hover,
html body.route-predictions .pred-card--clickable:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--pred-border);
  background: var(--pred-card);
}

html body.route-predictions .pred-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title link"
    "sub sub";
  column-gap: 12px;
  row-gap: 4px;
  margin: 0 0 16px;
}

html body.route-predictions .pred-card-title {
  grid-area: title;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

html body.route-predictions .pred-card-title h2,
html body.route-predictions .predictions-detail:not(.pred-math-lab) .pred-detail-title {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--pred-text);
}

html body.route-predictions .predictions-detail:not(.pred-math-lab) .pred-detail-title {
  font-size: 20px;
  font-weight: 700;
  margin: 4px 0 8px;
}

html body.route-predictions .pred-card-sub,
html body.route-predictions .predictions-detail:not(.pred-math-lab) .pred-detail-sub {
  grid-area: sub;
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--pred-text-2);
}

html body.route-predictions .pred-card-links {
  grid-area: link;
  display: flex;
  align-items: center;
  margin: 0;
  gap: 8px;
}

/* Per-card Model Lab chips go away. The page toolbar keeps the one accent link. */
html body.route-predictions .predictions-view .pred-tool--model-lab {
  display: none;
}

html body.route-predictions a.pred-math-link {
  display: inline;
  margin: 0;
  padding: 0;
  min-height: 0;
  height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  background-image: none;
  box-shadow: none;
  color: var(--pred-text-3);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-decoration: none;
  text-transform: none;
}

html body.route-predictions a.pred-math-link:hover {
  background: transparent;
  color: var(--pred-text);
}

html body.route-predictions .predictions-detail:not(.pred-math-lab) .pred-tool--model-lab {
  display: inline-flex;
  align-items: center;
  height: 32px;
  margin: 8px 0 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  background-image: none;
  box-shadow: none;
  color: var(--pred-accent);
  font-size: 13px;
  font-weight: 500;
}

html body.route-predictions .predictions-detail:not(.pred-math-lab) .pred-tool--model-lab:hover {
  background: transparent;
  border: 0;
  color: var(--pred-accent);
}

html body.route-predictions .pred-badge,
html body.route-predictions .pred-badge--ok,
html body.route-predictions .pred-badge--warm,
html body.route-predictions .pred-badge--fallback,
html body.route-predictions .pred-badge--paused,
html body.route-predictions .pred-badge--loading {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border: 1px solid var(--pred-border);
  border-radius: 6px;
  background: transparent;
  background-image: none;
  box-shadow: none;
  color: var(--pred-text-2);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  animation: none;
}

html body.route-predictions .pred-freshness,
html body.route-predictions .pred-freshness--unknown {
  margin: 0;
  color: var(--pred-text-3);
  font-size: 12px;
  font-weight: 400;
}

html body.route-predictions .pred-total-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

html body.route-predictions .pred-total-row .pred-total-num {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--pred-text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

html body.route-predictions .pred-total-row .pred-total-label,
html body.route-predictions .pred-label,
html body.route-predictions .pred-mini-head,
html body.route-predictions .pred-explain-kicker {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--pred-text-3);
}

html body.route-predictions .pred-meta-row {
  margin-top: 12px;
  gap: 12px;
}

html body.route-predictions .pred-num-sm,
html body.route-predictions .pred-version-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--pred-text);
  font-variant-numeric: tabular-nums;
}

html body.route-predictions .pred-math-live {
  margin: 8px 0 0;
  color: var(--pred-text-2);
  font-size: 12px;
  font-weight: 400;
}

/* Duplicate driver chips above the list. Drivers stay in a real explain. */
html body.route-predictions .predictions-view .pred-card-body > .pred-el-chips {
  display: none;
}

html body.route-predictions .predictions-view .pred-mini-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 8px;
  border: 1px solid var(--pred-border);
  border-radius: 10px;
  background: transparent;
  overflow: hidden;
}

html body.route-predictions .predictions-view .pred-forecast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0 8px;
  margin: 0;
  padding: 0 12px 0 0;
  border: 0;
  border-bottom: 1px solid var(--pred-border);
  border-radius: 0;
  background: transparent;
  min-width: 0;
}

html body.route-predictions .predictions-view .pred-forecast:last-child {
  border-bottom: 0;
}

html body.route-predictions .predictions-view .pred-forecast:hover,
html body.route-predictions .predictions-view .pred-forecast:focus-within {
  background: var(--pred-hover);
}

html body.route-predictions .predictions-view .pred-mini-list .pred-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin: 0;
  padding: 0 4px 0 12px;
  border: 0;
  background: transparent;
  font-size: 14px;
}

html body.route-predictions .predictions-view .pred-mini-list .pred-rank {
  display: inline;
  min-width: 0;
  width: auto;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  background-image: none;
  color: var(--pred-text-3);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

html body.route-predictions .predictions-view .pred-mini-list .pred-row-name,
html body.route-predictions .predictions-view .pred-name {
  min-width: 0;
  color: var(--pred-text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html body.route-predictions .predictions-view .pred-sub {
  color: var(--pred-text-3);
  font-size: 12px;
  font-weight: 400;
}

html body.route-predictions .predictions-view .pred-mini-list .pred-row-num,
html body.route-predictions .predictions-view .pred-num,
html body.route-predictions .predictions-view .pred-num--dim {
  color: var(--pred-text);
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
  letter-spacing: 0;
}

html body.route-predictions .predictions-view .pred-draft-btn {
  opacity: 0;
  width: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: transparent;
  background-image: none;
  box-shadow: none;
  color: var(--pred-text-2);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
}

html body.route-predictions .predictions-view .pred-forecast:hover .pred-draft-btn,
html body.route-predictions .predictions-view .pred-forecast:focus-within .pred-draft-btn,
html body.route-predictions .predictions-view .pred-draft-btn:focus-visible {
  opacity: 1;
  width: auto;
  padding: 0 4px;
  overflow: visible;
}

html body.route-predictions .predictions-view .pred-draft-btn:hover {
  background: transparent;
  border: 0;
  color: var(--pred-text);
}

html body.route-predictions .pred-explain,
html body.route-predictions .predictions-detail .pred-explain-row td {
  margin: 0;
  padding: 0 0 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  background-image: none;
  box-shadow: none;
}

html body.route-predictions .predictions-view .pred-forecast .pred-explain {
  grid-column: 1 / -1;
  padding: 0 12px 10px 48px;
}

html body.route-predictions .pred-explain--empty,
html body.route-predictions .pred-explain-line--empty,
html body.route-predictions .pred-backtest-missing {
  display: none;
}

html body.route-predictions .pred-explain-label {
  display: block;
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--pred-text-3);
}

html body.route-predictions .pred-explain-note,
html body.route-predictions .pred-explain .pred-el-chip {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--pred-text-2);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

html body.route-predictions .pred-explain .pred-el-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  background: transparent;
  border: 0;
}

html body.route-predictions .pred-empty,
html body.route-predictions .pred-empty--muted {
  padding: 8px 0;
  color: var(--pred-text-3);
  font-size: 13px;
  font-weight: 400;
  text-align: left;
}

html body.route-predictions .pred-showmore-btn {
  margin: 8px 0 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--pred-text-2);
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
}

html body.route-predictions .pred-showmore-btn:hover {
  background: transparent;
  border: 0;
  color: var(--pred-text);
}

html body.route-predictions .pred-quality {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

html body.route-predictions .pred-quality-kicker {
  margin: 0 0 4px;
  color: var(--pred-text-2);
  font-size: 13px;
  font-weight: 500;
}

html body.route-predictions .pred-quality-reason {
  margin: 0;
  color: var(--pred-text-2);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
}

/* Skeleton matches the loaded card: total, meta, then table rows. */
html body.route-predictions .pred-card[data-loading="true"] .pred-card-body,
html body.route-predictions .pred-card[data-loading="true"] .pred-skel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: 100%;
}

html body.route-predictions .pred-skel-total,
html body.route-predictions .pred-skel-meta,
html body.route-predictions .pred-skel-cell {
  border-radius: 6px;
  background: var(--pred-hover);
  background-image: none;
  animation: none;
  box-shadow: none;
}

html body.route-predictions .pred-skel-total {
  width: 96px;
  height: 28px;
}

html body.route-predictions .pred-skel-meta {
  width: 46%;
  max-width: 220px;
  height: 12px;
}

html body.route-predictions .predictions-view .pred-skel-list {
  margin-top: 4px;
  width: 100%;
  align-self: stretch;
}

html body.route-predictions .predictions-view .pred-skel-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 56px;
  gap: 12px;
  align-items: center;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-bottom: 1px solid var(--pred-border);
  background: transparent;
  box-sizing: border-box;
}

html body.route-predictions .predictions-view .pred-skel-row:last-child {
  border-bottom: 0;
}

html body.route-predictions .pred-skel-cell {
  display: block;
  height: 12px;
  width: auto;
  margin: 0;
}

html body.route-predictions .pred-skel-cell--rank { width: 16px; }
html body.route-predictions .pred-skel-cell--name { width: 46%; justify-self: start; }
html body.route-predictions .pred-skel-cell--num { width: 40px; justify-self: end; }

html body.route-predictions .pred-el-kpi {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

html body.route-predictions .pred-el-kpi-num {
  color: var(--pred-text);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0;
}

html body.route-predictions .pred-el-kpi-label,
html body.route-predictions .pred-el-kpi-sub,
html body.route-predictions .pred-el-chart h3 {
  color: var(--pred-text-2);
  font-weight: 500;
}

html body.route-predictions .pred-el-chart,
html body.route-predictions .pred-el-explore {
  background: transparent;
  border: 1px solid var(--pred-border);
  border-radius: 10px;
  box-shadow: none;
}

html body.route-predictions .predictions-detail:not(.pred-math-lab) .pred-detail-back {
  border: 0;
  background: transparent;
  color: var(--pred-text-2);
  font-size: 13px;
  font-weight: 500;
  padding: 0;
}

html body.route-predictions .predictions-detail:not(.pred-math-lab) .pred-detail-back:hover {
  color: var(--pred-text);
  border: 0;
}

html body.route-predictions .predictions-detail:not(.pred-math-lab) .pred-detail-tablewrap {
  border: 1px solid var(--pred-border);
  border-radius: 10px;
  background: var(--pred-card);
  box-shadow: none;
}

html body.route-predictions .predictions-detail:not(.pred-math-lab) .pred-detail-table thead th {
  background: transparent;
  color: var(--pred-text-3);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  border-bottom: 1px solid var(--pred-border);
}

html body.route-predictions .predictions-detail:not(.pred-math-lab) .pred-detail-table tbody td {
  color: var(--pred-text);
  font-size: 14px;
  font-weight: 400;
  border-bottom: 1px solid var(--pred-border);
}

html body.route-predictions .predictions-detail:not(.pred-math-lab) .pred-detail-custlink {
  color: var(--pred-text);
  border-bottom: 0;
  font-weight: 500;
}

html body.route-predictions .predictions-detail:not(.pred-math-lab) .pred-detail-custlink:hover {
  color: var(--pred-text);
}

html body.route-predictions .pred-backtest-table th {
  color: var(--pred-text-3);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

html body.route-predictions .pred-draft {
  background: var(--pred-raised);
  border: 1px solid var(--pred-border);
  border-radius: 10px;
  box-shadow: none;
}

html body.route-predictions .pred-draft-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--pred-text);
}

html body.route-predictions .pred-draft-body,
html body.route-predictions .pred-draft-close {
  border: 1px solid var(--pred-border);
  border-radius: 6px;
  background: var(--pred-card);
  color: var(--pred-text);
  font-weight: 400;
  box-shadow: none;
}

@media (max-width: 820px) {
  html body.route-predictions,
  html body.route-predictions #main,
  html body.route-predictions #main-content,
  html body.route-predictions .predictions-view,
  html body.route-predictions .predictions-detail {
    overflow-x: hidden;
    max-width: 100%;
  }

  html body.route-predictions .predictions-view,
  html body.route-predictions .predictions-detail:not(.pred-math-lab) {
    padding: 8px 0 32px;
  }

  html body.route-predictions .pred-grid,
  html body.route-predictions .predictions-view .pred-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  html body.route-predictions .pred-card {
    padding: 16px;
  }

  html body.route-predictions .pred-card-head {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "title"
      "sub"
      "link";
  }

  html body.route-predictions .predictions-view .pred-draft-btn {
    opacity: 1;
    width: auto;
    padding: 0 4px;
    overflow: visible;
  }

  html body.route-predictions .predictions-view .pred-mini-list .pred-row-name {
    font-size: 14px;
  }
}
