:root {
  --bg: #03060a;
  --panel: #081018;
  --panel-2: #0d1924;
  --panel-3: #111f2b;
  --line: #243949;
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #f2f8fb;
  --muted: #9aa8b1;
  --blue: #0b37ff;
  --blue-bright: #2478ff;
  --cyan: #25a9ff;
  --gold: #d6b56d;
  --gold-soft: rgba(214, 181, 109, 0.18);
  --green: #35c759;
  --shadow: 0 18px 52px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(130deg, rgba(11, 55, 255, 0.18), transparent 34%),
    linear-gradient(315deg, rgba(214, 181, 109, 0.12), transparent 32%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.018) 0, rgba(255,255,255,0.018) 1px, transparent 1px, transparent 54px),
    var(--bg);
  color: var(--text);
  font-family: Aptos, "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: uppercase;
}

button,
select {
  font: inherit;
}

.app {
  width: min(1740px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 16px 18px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(214, 181, 109, 0.28);
  background: rgba(3, 6, 10, 0.92);
  backdrop-filter: blur(14px);
}

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

.crest {
  width: 54px;
  height: 54px;
  object-fit: cover;
  object-position: center;
  border-radius: 6px;
  filter: drop-shadow(0 0 18px rgba(11, 55, 255, 0.58));
}

.brand-title {
  display: grid;
  gap: 5px;
  min-width: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.18rem, 1.75vw, 1.75rem);
  line-height: 0.98;
  font-weight: 650;
  text-transform: uppercase;
}

.brand-lockup p {
  margin: 0;
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 500;
  text-transform: uppercase;
}

.source-chip,
label {
  color: var(--muted);
}

.controls {
  display: grid;
  grid-template-columns: minmax(190px, 0.9fr) minmax(220px, 1.05fr) minmax(160px, 0.7fr) minmax(240px, 1.1fr);
  gap: 10px;
  align-items: end;
  padding: 8px 0 10px;
  border-bottom: 1px solid rgba(36, 57, 73, 0.9);
}

.dashboard-switcher {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  gap: 14px;
  align-items: end;
  padding: 8px 0 2px;
}

.dashboard-switcher label {
  min-height: 0;
}

.dashboard-switcher p {
  min-height: 40px;
  margin: 0;
  display: flex;
  align-items: center;
  color: #c6d0d6;
  font-size: 0.82rem;
}

.dashboard-switcher p:empty,
.panel-head p:empty,
.panel-head small:empty,
.metric-evidence-block p:empty,
footer:empty {
  display: none;
}

.source-chip,
label {
  min-height: 40px;
  display: grid;
  align-content: center;
  gap: 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
}

select {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(36, 120, 255, 0.42);
  border-radius: 8px;
  background: linear-gradient(180deg, #0e1b27, #071018);
  color: var(--text);
  padding: 0 10px;
  outline: none;
  color-scheme: dark;
}

select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(214, 181, 109, 0.16);
}

select option {
  background: #071018;
  color: #f2f8fb;
}

select:disabled {
  opacity: 0.56;
  border-color: rgba(154, 168, 177, 0.24);
}

.profile-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
  padding-top: 12px;
}

.athlete-panel,
.panel {
  border: 1px solid rgba(54, 82, 104, 0.78);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(17, 31, 43, 0.96), rgba(6, 13, 20, 0.96));
  box-shadow: var(--shadow);
}

.athlete-panel {
  position: sticky;
  top: 82px;
  align-self: start;
  padding: 12px;
  border-color: rgba(214, 181, 109, 0.3);
  background:
    linear-gradient(180deg, rgba(10, 26, 41, 0.98), rgba(4, 9, 14, 0.98));
}

.portrait {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(36, 120, 255, 0.18), rgba(214, 181, 109, 0.08)),
    #121c23;
  color: var(--gold);
  font-size: 2.7rem;
  font-weight: 650;
}

.portrait img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-bottom: 3px solid var(--blue-bright);
}

.portrait img + span {
  display: none;
}

.portrait.fallback::before {
  content: "";
  position: absolute;
  width: 34%;
  aspect-ratio: 1;
  top: 20%;
  border-radius: 50%;
  background: #273947;
}

.portrait.fallback::after {
  content: "";
  position: absolute;
  width: 62%;
  height: 32%;
  bottom: 10%;
  border-radius: 50% 50% 12px 12px;
  background: #20303d;
}

.portrait span {
  position: relative;
  z-index: 1;
}

.athlete-title {
  padding: 12px 0 10px;
}

.athlete-title h2 {
  margin-bottom: 6px;
  font-size: 1.35rem;
  color: #ffffff;
}

.athlete-title p {
  margin-bottom: 0;
  color: var(--muted);
}

.bio-grid {
  display: grid;
  gap: 8px;
}

.bio-item,
.evidence-item {
  display: grid;
  gap: 4px;
  min-height: 48px;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.bio-item span,
.evidence-item span,
.quality-card span {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
}

.bio-item strong,
.evidence-item strong {
  font-size: 0.95rem;
  color: #f7fbff;
}

.evidence-item small {
  color: #9fb2bf;
  font-size: 0.76rem;
}

.match-item strong {
  font-size: 1.1rem;
}

.profile-main {
  min-width: 0;
}

.quality-card small,
.panel-head p,
.panel-head small,
footer {
  color: var(--muted);
}

.quality-card small {
  display: block;
  margin-top: 7px;
  font-size: 0.76rem;
}

.profile-sections {
  display: grid;
  grid-template-columns: minmax(290px, 0.72fr) minmax(430px, 1.05fr) minmax(470px, 1.18fr);
  grid-template-areas:
    "qualities radar chart";
  gap: 14px;
  align-items: stretch;
}

.qualities-panel {
  grid-area: qualities;
  min-width: 0;
}

.chart-panel,
.radar-panel {
  min-width: 0;
}

.radar-panel {
  grid-area: radar;
}

.chart-panel {
  grid-area: chart;
}

.panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-bottom: 1px solid rgba(214, 181, 109, 0.22);
  background:
    linear-gradient(90deg, rgba(11, 55, 255, 0.16), rgba(214, 181, 109, 0.08), transparent);
}

.panel-head h2 {
  margin: 0;
  font-size: 0.95rem;
  text-transform: uppercase;
  color: #ffffff;
}

.panel-head p {
  margin: 4px 0 0;
  font-size: 0.78rem;
}

.quality-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.quality-card {
  min-height: 76px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  border-left: 0;
  background:
    linear-gradient(145deg, rgba(36, 120, 255, 0.1), transparent 54%),
    rgba(255, 255, 255, 0.018);
}

.quality-card strong {
  display: block;
  margin-top: 5px;
  font-size: 1.08rem;
  line-height: 1;
  color: #ffffff;
}

.sparkline {
  width: 100%;
  height: 24px;
  margin-top: 7px;
  overflow: visible;
}

#trendChart {
  width: 100%;
  height: 300px;
  min-height: 260px;
  display: block;
  background: #071017;
  border-top: 1px solid rgba(36, 120, 255, 0.18);
}

#radarChart {
  width: 100%;
  height: 560px;
  min-height: 500px;
  display: block;
  background: #071017;
  border-top: 1px solid rgba(36, 120, 255, 0.18);
}

svg text {
  font-family: Aptos, "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  text-transform: uppercase;
}

.md-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 9px 13px;
  border-top: 1px solid rgba(36, 120, 255, 0.18);
  background: rgba(2, 7, 12, 0.78);
}

.md-strip[hidden] {
  display: none;
}

.md-strip span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
}

.md-strip strong {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid rgba(36, 120, 255, 0.5);
  border-radius: 999px;
  background: rgba(36, 120, 255, 0.14);
  color: #f7f1dd;
  font-size: 0.72rem;
}

.metric-evidence-block {
  border-top: 1px solid rgba(214, 181, 109, 0.22);
  background:
    linear-gradient(90deg, rgba(214, 181, 109, 0.1), transparent 48%),
    rgba(3, 8, 13, 0.72);
}

.metric-evidence-block > div:first-child {
  padding: 11px 12px 0;
}

.metric-evidence-block h2 {
  margin: 0;
  color: #ffffff;
  font-size: 0.95rem;
  text-transform: uppercase;
}

.metric-evidence-block p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

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

.empty-state {
  padding: 14px;
  color: var(--muted);
}

footer {
  padding: 12px 0;
  font-size: 0.72rem;
  color: #aeb8be;
}

.error-state {
  max-width: 720px;
  margin: 80px auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

@media (max-width: 1100px) {
  .controls,
  .dashboard-switcher,
  .profile-layout,
  .profile-sections {
    grid-template-columns: 1fr;
  }

  .athlete-panel {
    position: static;
  }

  .portrait {
    max-width: 360px;
  }

  .quality-grid,
  .evidence-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  body {
    overflow-x: hidden;
  }

  .app {
    padding: 0 10px 18px;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    gap: 12px;
    min-height: 0;
  }

  .brand-lockup {
    align-items: center;
    gap: 10px;
  }

  .crest {
    width: 52px;
    height: 52px;
    flex: 0 0 auto;
  }

  h1 {
    font-size: 1.05rem;
  }

  .brand-lockup p {
    font-size: 0.66rem;
  }

  .profile-layout,
  .profile-sections,
  .controls,
  .dashboard-switcher,
  .panel,
  .athlete-panel {
    min-width: 0;
  }

  #trendChart,
  #radarChart {
    height: 330px;
    min-height: 300px;
  }
}

body {
  font-family: "Segoe UI Variable Text", Aptos, "Avenir Next", "Segoe UI", Arial, sans-serif;
  font-weight: 430;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
strong,
th,
.summary-card strong,
.athlete-title strong,
.metric-value,
.card-value {
  font-weight: 620;
}

label,
small,
td,
p,
.panel-head p,
.panel-head small {
  font-weight: 430;
}

.panel,
.athlete-panel,
.summary-card,
.metric-card,
.quality-card,
.chart-panel,
.radar-panel,
.command-card,
.group-card,
.baseline-card,
.wellness-card,
.density-card {
  border-color: rgba(74, 112, 139, 0.88);
  box-shadow:
    inset 0 0 0 1px rgba(214, 181, 109, 0.08),
    0 18px 46px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(36, 120, 255, 0.07);
}

.panel-head {
  border-bottom-color: rgba(214, 181, 109, 0.32);
}

select,
input,
button {
  font-family: inherit;
}

select,
input {
  border-color: rgba(78, 137, 190, 0.72);
  box-shadow: inset 0 0 0 1px rgba(214, 181, 109, 0.07);
}

.table-wrap {
  border: 1px solid rgba(74, 112, 139, 0.78);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(214, 181, 109, 0.06);
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th {
  border-bottom: 1px solid rgba(214, 181, 109, 0.3);
}

td {
  border-bottom-color: rgba(88, 121, 145, 0.26);
}
