:root {
  color-scheme: light;
  --navy-950: #071421;
  --navy-900: #0d2033;
  --navy-800: #16314a;
  --ink: #132231;
  --muted: #64748b;
  --panel: #ffffff;
  --line: #dbe3ec;
  --wash: #f4f7fb;
  --orange: #f97316;
  --amber: #fbbf24;
  --red: #ef4444;
  --teal: #14b8a6;
  --blue: #2563eb;
  --green: #16a34a;
  --shadow: 0 18px 48px rgba(7, 20, 33, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(249, 115, 22, 0.18), transparent 32rem),
    linear-gradient(180deg, var(--navy-950), var(--navy-900) 18rem, var(--wash) 18rem);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

.progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: 3px;
  background: transparent;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.progress.active {
  opacity: 1;
}

.progress span {
  display: block;
  width: 45%;
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--amber), var(--teal));
  animation: slide 1s ease-in-out infinite;
}

@keyframes slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(230%); }
}

.topbar {
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px 24px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: white;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(249, 115, 22, 0.35);
}

.brand h1 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.1;
}

.brand p {
  margin: 3px 0 0;
  color: #cbd5e1;
  font-size: 0.9rem;
}

.status-pill {
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #e5edf6;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.panel-heading .status-pill {
  color: var(--ink);
  background: #fff7ed;
  border-color: #fdba74;
}

.action-pill {
  text-decoration: none;
  font-weight: 800;
}

.action-pill:hover {
  background: #ffedd5;
}

.nav-pill {
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 9px 13px;
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.nav-pill:hover {
  border-color: rgba(249, 115, 22, 0.7);
  background: rgba(249, 115, 22, 0.18);
}

button.status-pill {
  cursor: pointer;
  color: var(--ink);
  background: #fff7ed;
  border-color: #fdba74;
}

button.status-pill:hover {
  background: #ffedd5;
}

.layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px 42px;
}

.site-footer {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px 34px;
}

.relay-footer {
  max-width: none;
}

.partner-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.partner-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  border: 1px solid rgba(219, 227, 236, 0.95);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.98);
  text-decoration: none;
  box-shadow: 0 12px 32px rgba(7, 20, 33, 0.1);
}

.partner-card:hover {
  border-color: rgba(249, 115, 22, 0.7);
  background: #fff7ed;
}

.partner-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.partner-card strong {
  color: var(--ink);
  font-size: 1rem;
}

.search-panel,
.view-panel {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(219, 227, 236, 0.9);
  box-shadow: var(--shadow);
}

.search-panel {
  border-radius: 8px;
  padding: 14px;
  position: relative;
  z-index: 10;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 12px;
}

.search-box {
  position: relative;
}

.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 44px;
  padding: 10px 12px;
  outline: none;
}

.search-box input {
  padding-left: 44px;
}

input:focus,
select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.16);
}

.search-results,
.mini-results {
  display: none;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.search-results.open,
.mini-results.open {
  display: block;
}

.result-group + .result-group {
  border-top: 1px solid var(--line);
}

.group-title {
  padding: 10px 12px 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.result-item {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: #fff;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}

.result-item:hover {
  background: #fff7ed;
}

.result-item strong {
  display: block;
  line-height: 1.2;
}

.result-item span {
  color: var(--muted);
  font-size: 0.86rem;
}

.result-item .tag {
  align-self: center;
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef6ff;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 800;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.link-button:hover {
  color: var(--orange);
}

.content-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 20px;
  align-items: start;
}

.content-grid.single-column {
  grid-template-columns: 1fr;
}

.view-panel {
  border-radius: 8px;
  padding: 18px;
  min-width: 0;
}

.primary-view {
  min-height: 520px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.eyebrow {
  display: block;
  color: var(--orange);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h2,
h3 {
  margin: 0;
  color: var(--ink);
}

h2 {
  font-size: 1.45rem;
}

h3 {
  font-size: 1.05rem;
}

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

.empty-state {
  min-height: 470px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  font-size: 2rem;
  color: var(--ink);
}

.summary-grid,
.score-grid,
.rank-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: linear-gradient(180deg, #fff, #f8fafc);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.35rem;
}

.stars {
  color: var(--amber);
  font-size: 1.15rem;
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
  background: #fff;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 0.9rem;
}

th {
  background: #f8fafc;
  color: #334155;
  font-size: 0.75rem;
  text-transform: uppercase;
}

tr.pb-row td {
  background: #fff8eb;
}

.pb-badge,
.up-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 0.76rem;
  font-weight: 900;
}

.pb-badge {
  color: #9a3412;
  background: #ffedd5;
}

.up-badge {
  color: var(--green);
  background: #dcfce7;
}

.section-block {
  margin-top: 22px;
}

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

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.chart-card,
.chart-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  height: 320px;
  min-height: 0;
  overflow: hidden;
}

.chart-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

.chart-card canvas,
.chart-shell canvas {
  width: 100%;
  height: 260px !important;
  max-height: 260px;
  min-height: 0;
  display: block;
}

.chart-card canvas {
  align-self: stretch;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.team-add {
  position: relative;
  margin-top: 12px;
}

.mini-results {
  position: absolute;
  inset-inline: 0;
  z-index: 20;
  max-height: 260px;
  overflow: auto;
  box-shadow: 0 18px 44px rgba(7, 20, 33, 0.2);
}

.team-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.team-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border-radius: 999px;
  padding: 7px 8px 7px 10px;
  color: #fff;
  font-size: 0.84rem;
  font-weight: 800;
}

.team-card button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  cursor: pointer;
}

.relay-panel {
  position: sticky;
  top: 14px;
}

.message {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  background: #f8fafc;
}

.chart-card .message {
  margin-top: 14px;
  min-height: 0;
  height: 240px;
  display: grid;
  place-items: center;
  text-align: center;
}

.relay-layout {
  max-width: none;
  width: 100%;
}

.relay-workspace {
  width: 100%;
}

.relay-controls {
  display: grid;
  grid-template-columns: 160px 180px minmax(280px, 1fr);
  gap: 12px;
  align-items: end;
}

.relay-chart-shell {
  width: 100%;
  height: min(70vh, 720px);
  min-height: 460px;
}

.relay-chart-shell canvas {
  height: 100% !important;
  max-height: none;
}

.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

@media (max-width: 1120px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .relay-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .topbar {
    padding-inline: 14px;
    align-items: flex-start;
  }

  .brand img {
    width: 46px;
    height: 46px;
  }

  .brand h1 {
    font-size: 1.1rem;
  }

  .brand p,
  .status-pill,
  .nav-pill {
    font-size: 0.78rem;
  }

  .layout {
    padding-inline: 14px;
  }

  .search-row,
  .partner-links,
  .control-grid,
  .relay-controls,
  .summary-grid,
  .score-grid,
  .rank-grid,
  .chart-grid {
    grid-template-columns: 1fr;
  }

  .view-panel {
    padding: 14px;
  }

  h2 {
    font-size: 1.18rem;
  }

  .chart-card,
  .chart-shell {
    height: 290px;
  }

  .chart-card canvas,
  .chart-shell canvas {
    height: 230px !important;
    max-height: 230px;
  }

  .relay-chart-shell {
    height: 64vh;
    min-height: 360px;
  }

  .relay-chart-shell canvas {
    height: 100% !important;
    max-height: none;
  }
}
