:root {
  --s-good: #1f9d55; --s-warn: #d99a00; --s-serious: #e8650a; --s-crit: #d32f2f;
  --smoke: #009bff;
}
.top-nav a[aria-current="page"] { color: var(--brand); }
.sp-hero { padding-bottom: 36px; }
.sp-hero .hero-head { margin-bottom: 24px; }
.sp-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sp-range { display: inline-flex; background: var(--raised); border: 1px solid rgba(0,155,255,.2); border-radius: 999px; padding: 4px; gap: 2px; }
.sp-range button { border: 0; background: transparent; color: #b8cde0; font: 600 13px Montserrat, sans-serif; padding: 8px 16px; border-radius: 999px; cursor: pointer; }
.sp-range button:hover { color: #fff; }
.sp-range button[aria-pressed="true"] { background: var(--brand-hi); color: var(--navy); }
.sp-updated { margin: 0; font-size: 13px; color: #8fa9c1; }

.sp-main { padding: 28px 0 64px; }
.sp-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.sp-legend span { display: inline-flex; align-items: center; gap: 8px; }
.sp-legend i { display: inline-block; }
.lg-line { width: 18px; height: 2px; background: var(--brand); border-radius: 2px; }
.lg-smoke { width: 18px; height: 10px; background: rgba(0,155,255,.22); border-radius: 2px; }
.lg-loss i { width: 10px; height: 6px; border-radius: 2px; margin-right: -6px; }
.lg-loss i:last-child { margin-right: 0; }
.s-good { background: var(--s-good); } .s-warn { background: var(--s-warn); }
.s-serious { background: var(--s-serious); } .s-crit { background: var(--s-crit); }

.sp-group h2 { font-size: 18px; margin: 28px 0 14px; }
.sp-note { margin: -8px 0 14px; font-size: 13px; color: var(--muted); max-width: 720px; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.sp-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 16px 12px; min-width: 0; }
.sp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sp-name { font: 600 15px Montserrat, sans-serif; margin: 0; }
.sp-host { font: 12px var(--mono); color: var(--muted); margin: 2px 0 0; overflow-wrap: anywhere; }
.sp-stats { display: flex; gap: 18px; margin: 12px 0 6px; font-size: 13px; color: var(--muted); }
.sp-stats b { display: block; font: 600 17px Montserrat, sans-serif; color: var(--ink); font-variant-numeric: tabular-nums; }
.sp-stats small { font: 500 12px Poppins, sans-serif; color: var(--muted); }
.sp-chart { position: relative; height: 150px; touch-action: pan-y; }
.sp-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.sp-chart text { font: 10.5px Poppins, sans-serif; fill: var(--muted); }
.sp-grid-line { stroke: #e6ecf2; stroke-width: 1; }
.sp-cross { stroke: #9fb3c6; stroke-width: 1; stroke-dasharray: 3 3; }

.st-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.st-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-good { background: #e3f6ec; color: #13703b; }
.st-warn { background: #fff5d6; color: #8a6100; }
.st-serious { background: #ffeadb; color: #a5470a; }
.st-crit { background: #fde8e8; color: #b42020; }
.st-none { background: #eef2f6; color: var(--muted); }

.sp-tip { position: fixed; z-index: 70; pointer-events: none; background: var(--navy); color: #e8f1fa; border-radius: 10px; padding: 10px 12px; font-size: 12.5px; line-height: 1.5; box-shadow: 0 8px 24px rgba(2,26,46,.25); min-width: 170px; }
.sp-tip b { font-family: Montserrat, sans-serif; font-weight: 600; }
.sp-tip .row { display: flex; justify-content: space-between; gap: 14px; }
.sp-tip .row span:first-child { color: #8fb4d4; }

.sp-empty { color: var(--muted); padding: 24px 0; }
.sp-table-sec { margin-top: 40px; }
.sp-table-sec h2 { font-size: 18px; margin-bottom: 14px; }
.sp-table td:nth-child(n+2) { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sp-table small { color: var(--muted); }

@media (max-width: 600px) {
  .sp-grid { grid-template-columns: 1fr; }
  .sp-range button { padding: 8px 11px; }
  .sp-controls { flex-direction: column; align-items: flex-start; }
}

/* Search & filter bar — sticks under the header while scrolling through many targets */
.sp-filter { position: sticky; top: 64px; z-index: 15; background: var(--surface); padding: 14px 0 12px; margin: -14px 0 14px; border-bottom: 1px solid var(--line); }
.sp-search { position: relative; display: block; max-width: 560px; }
.sp-search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.sp-search input { padding-left: 42px; padding-right: 40px; border-radius: 999px; }
.sp-search input::-webkit-search-cancel-button { cursor: pointer; }
.sp-search kbd { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font: 500 11px var(--mono); color: var(--muted); border: 1px solid #c8d3df; border-radius: 5px; padding: 1px 6px; background: #fff; pointer-events: none; }
.sp-search input:focus + kbd, .sp-search input:not(:placeholder-shown) + kbd { display: none; }
.sp-chips { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.sp-chips::-webkit-scrollbar { display: none; }
.sp-chips button { flex: none; border: 1px solid #c8d3df; background: #fff; color: var(--ink); border-radius: 999px; padding: 6px 14px; font: 500 13px Poppins, sans-serif; cursor: pointer; }
.sp-chips button:hover { border-color: var(--brand); color: var(--brand); }
.sp-chips button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.sp-chips .chip-issue[aria-pressed="true"] { background: var(--s-crit); border-color: var(--s-crit); }
.sp-count { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.sp-nores { background: var(--card); border: 1px dashed #c8d3df; border-radius: var(--r); padding: 28px; text-align: center; color: var(--muted); margin-top: 20px; }
.sp-nores button { margin-top: 12px; }
mark { background: #fff1b8; color: inherit; border-radius: 3px; padding: 0 1px; }
@media (max-width: 600px) {
  .sp-search kbd { display: none; }
}
.sp-search input { -webkit-appearance: none; appearance: none; width: 100%; }

/* Route (MTR) panel */
.sp-head-r { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.sp-route-btn { border: 1px solid #c8d3df; background: #fff; color: var(--brand); border-radius: 999px; padding: 3px 12px; font: 500 12px Poppins, sans-serif; cursor: pointer; }
.sp-route-btn:hover { border-color: var(--brand); background: #eef7fe; }
.sp-route { border: 0; padding: 0; border-radius: var(--r); width: min(900px, calc(100% - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 24px 64px rgba(2,26,46,.35); color: var(--ink); }
.sp-route::backdrop { background: rgba(2,26,46,.55); }
.sp-route-in { padding: 22px 24px 20px; }
.sp-route-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.sp-route-title { font-size: 20px; }
.sp-route-host { margin: 2px 0 0; font: 13px var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.ico-close { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #eef2f6; color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer; }
.ico-close:hover { background: #e1e8ef; }
.sp-route-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.sp-route-hist { max-width: 420px; margin-bottom: 14px; }
.sp-route-stable { font-size: 13px; color: var(--ok); margin: 0 0 14px; }
.sp-route-tbl td, .sp-route-tbl th { white-space: nowrap; font-variant-numeric: tabular-nums; }
.sp-route-tbl td:nth-child(2) { white-space: normal; min-width: 180px; }
.sp-route-tbl td:nth-child(n+3), .sp-route-tbl th:nth-child(n+3) { text-align: right; }
.sp-route-tbl b { font-weight: 500; overflow-wrap: anywhere; }
.sp-route-tbl code { font-size: 12px; color: var(--muted); }
.loss-good { color: var(--ok); } .loss-warn { color: #8a6100; } .loss-serious { color: #a5470a; } .loss-crit { color: var(--bad); font-weight: 500; }
.sp-route-note { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; }
@media (max-width: 600px) {
  .sp-route { width: 100%; max-width: 100%; max-height: 100%; height: 100%; border-radius: 0; margin: 0; }
  .sp-route-in { padding: 16px; }
  .sp-route-tbl td:nth-child(2) { min-width: 150px; }
}
.sp-route-tbl tr.is-dest td { background: #f4f9fe; font-weight: 500; }
