:root {
  color-scheme: dark;
  --bg: #090b10;
  --surface: #11151d;
  --surface-2: #161b25;
  --surface-3: #1b2230;
  --line: #263040;
  --line-soft: rgba(119, 142, 174, 0.14);
  --text: #f2f5f9;
  --muted: #8994a6;
  --accent: #ff5968;
  --accent-soft: rgba(255, 89, 104, 0.12);
  --positive: #38d7bd;
  --positive-soft: rgba(56, 215, 189, 0.11);
  --info: #82aaff;
  --warning: #f4bd67;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 55% -20%, rgba(49, 72, 111, 0.23), transparent 38%),
    linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 48px 48px, 48px 48px, auto;
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(10, 13, 19, 0.94);
  backdrop-filter: blur(22px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 72px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 27px;
  height: 27px;
  border: 4px solid var(--accent);
  border-radius: 50%;
}

.brand-mark::after {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 13px;
  height: 13px;
  border: 3px solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

nav {
  display: grid;
  gap: 6px;
  padding: 22px 12px;
}

.nav-item,
.sidebar .ghost-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  text-decoration: none;
  transition: 160ms ease;
}

.nav-item:hover,
.sidebar .ghost-button:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-icon {
  display: inline-grid;
  width: 22px;
  place-items: center;
  font-size: 18px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px 22px;
  border-top: 1px solid var(--line-soft);
}

.privacy-note {
  padding: 14px;
  color: #667286;
  font-size: 11px;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 13, 19, 0.86);
  backdrop-filter: blur(20px);
}

.search-form {
  display: flex;
  width: min(760px, 70%);
  gap: 9px;
}

.search-wrap {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 15px;
  color: var(--muted);
  font-size: 22px;
  transform: translateY(-50%);
  pointer-events: none;
}

input,
select {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: rgba(20, 25, 35, 0.94);
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
select:focus {
  border-color: rgba(255, 89, 104, 0.72);
  box-shadow: 0 0 0 3px rgba(255, 89, 104, 0.1);
}

.search-wrap input {
  width: 100%;
  padding: 0 15px 0 45px;
}

select {
  padding: 0 30px 0 12px;
}

.primary-button,
.ghost-button,
.icon-button {
  border: 0;
  cursor: pointer;
}

.primary-button {
  min-width: 92px;
  height: 44px;
  padding: 0 22px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ff6471, #f74355);
  box-shadow: 0 9px 24px rgba(247, 67, 85, 0.2);
  color: white;
  font-weight: 700;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.top-status {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #bac3d2;
}

.status-pill i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 12px currentColor;
}

.status-pill.ready i {
  background: var(--positive);
}

.status-pill.error i {
  background: var(--accent);
}

.content {
  max-width: 1740px;
  margin: 0 auto;
  padding: 22px 24px 48px;
}

.notice {
  margin-bottom: 14px;
  padding: 12px 15px;
  border: 1px solid rgba(244, 189, 103, 0.28);
  border-radius: 8px;
  background: rgba(244, 189, 103, 0.08);
  color: #f5d29a;
  font-size: 13px;
}

.notice.error {
  border-color: rgba(255, 89, 104, 0.28);
  background: var(--accent-soft);
  color: #ffb0b8;
}

.hero-card,
.panel,
.metric-card {
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.018), transparent 40%),
    rgba(17, 21, 29, 0.96);
  box-shadow: var(--shadow);
}

.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 132px;
  padding: 22px 26px;
  border-radius: 12px;
}

.player-card {
  display: flex;
  align-items: center;
  gap: 18px;
}

.avatar-shell {
  display: grid;
  width: 82px;
  height: 82px;
  overflow: hidden;
  place-items: center;
  border: 1px solid rgba(255, 89, 104, 0.72);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 89, 104, 0.3), rgba(34, 42, 58, 0.8));
  color: #ff9ca5;
  font-weight: 800;
  letter-spacing: 0.14em;
  transform: rotate(1deg);
}

.avatar-shell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.eyebrow {
  margin-bottom: 5px;
  color: #657187;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 9px;
  font-size: clamp(22px, 2vw, 32px);
}

h2 {
  margin-bottom: 0;
  font-size: 16px;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.profile-meta span {
  padding: 4px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.018);
}

.season-heading {
  display: grid;
  justify-items: end;
  gap: 8px;
  color: #c7cfdb;
  font-size: 13px;
}

.freshness {
  color: var(--muted);
  font-size: 11px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  margin: 10px 0;
}

.metric-card {
  position: relative;
  min-height: 104px;
  padding: 18px;
  overflow: hidden;
  border-radius: 9px;
}

.metric-card::after {
  position: absolute;
  right: -18px;
  bottom: -26px;
  width: 78px;
  height: 78px;
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  content: "";
}

.metric-label {
  color: var(--muted);
  font-size: 11px;
}

.metric-value {
  margin-top: 10px;
  font-size: 25px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.metric-foot {
  margin-top: 6px;
  color: #627087;
  font-size: 10px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 10px;
}

.main-column,
.side-column {
  display: grid;
  align-content: start;
  gap: 10px;
}

.panel {
  overflow: hidden;
  border-radius: 10px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 14px 17px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-caption {
  color: var(--muted);
  font-size: 11px;
}

.match-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.match-table {
  width: 100%;
  min-width: 790px;
  border-collapse: collapse;
  font-size: 12px;
}

.match-table th {
  height: 38px;
  padding: 0 13px;
  color: #67748a;
  font-size: 10px;
  font-weight: 600;
  text-align: left;
}

.match-table td {
  height: 62px;
  padding: 8px 13px;
  border-top: 1px solid var(--line-soft);
  color: #cbd2dc;
  font-variant-numeric: tabular-nums;
}

.match-table tr {
  transition: background 140ms ease;
}

.match-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.match-table tr.win {
  box-shadow: inset 3px 0 0 var(--positive);
}

.match-table tr.loss {
  box-shadow: inset 3px 0 0 var(--accent);
}

.result-win {
  color: var(--positive);
  font-weight: 700;
}

.result-loss {
  color: var(--accent);
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.subline {
  display: block;
  margin-top: 4px;
  color: #657187;
  font-size: 10px;
}

.agent-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.agent-thumb {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  overflow: hidden;
  place-items: center;
  border-radius: 7px;
  background: linear-gradient(145deg, #293449, #151b25);
  color: #9baac1;
}

.agent-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.point-positive {
  color: var(--positive);
}

.point-negative {
  color: var(--accent);
}

.detail-link {
  color: var(--info);
  white-space: nowrap;
}

.detail-link[disabled] {
  color: #4f5c70;
  cursor: not-allowed;
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
}

.icon-button:hover {
  background: var(--surface-3);
  color: var(--text);
}

.detail-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 17px;
  color: var(--muted);
  font-size: 11px;
}

.detail-summary span {
  padding: 4px 8px;
  border-radius: 5px;
  background: var(--surface-3);
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 12px 14px;
}

.team {
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.team-title {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(130, 170, 255, 0.09);
  font-size: 12px;
  font-weight: 700;
}

.team:nth-child(2) .team-title {
  background: rgba(255, 89, 104, 0.09);
}

.detail-player {
  display: grid;
  grid-template-columns: minmax(110px, 1.5fr) repeat(4, minmax(46px, 0.5fr));
  align-items: center;
  min-height: 48px;
  padding: 6px 10px;
  border-top: 1px solid var(--line-soft);
  color: #c3ccd8;
  font-size: 11px;
}

.detail-player.me {
  background: rgba(244, 189, 103, 0.07);
}

.party-tag {
  display: inline-block;
  margin-left: 5px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(130, 170, 255, 0.12);
  color: #a8c2ff;
  font-size: 9px;
}

.relationship-rule {
  margin: 14px 16px 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.associate-list {
  padding: 4px 10px 12px;
}

.associate {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 7px;
  border-bottom: 1px solid var(--line-soft);
}

.associate:last-child {
  border-bottom: 0;
}

.associate-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid #354259;
  border-radius: 50%;
  background: var(--surface-3);
  color: #9fb0c8;
  font-size: 11px;
  font-weight: 700;
}

.associate-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.associate-meta {
  margin-top: 4px;
  color: #68758a;
  font-size: 10px;
}

.associate-count {
  color: var(--positive);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: right;
}

.associate-count span {
  display: block;
  color: #657187;
  font-size: 9px;
  font-weight: 500;
}

.info-dot {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid #536077;
  border-radius: 50%;
  color: #8996aa;
  font-size: 11px;
}

.service-stats {
  margin: 0;
  padding: 8px 16px 16px;
}

.service-stats div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}

.service-stats div:last-child {
  border-bottom: 0;
}

.service-stats dt {
  color: var(--muted);
  font-size: 11px;
}

.service-stats dd {
  margin: 0;
  color: #cbd2dc;
  font-size: 11px;
  text-align: right;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.agent-stat {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 11px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.012);
}

.agent-stat .agent-thumb {
  width: 44px;
  height: 44px;
}

.agent-name {
  margin-bottom: 7px;
  font-size: 12px;
}

.progress {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #283142;
}

.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--positive), #7fe4d3);
}

.progress i.p5 { width: 5%; }
.progress i.p10 { width: 10%; }
.progress i.p15 { width: 15%; }
.progress i.p20 { width: 20%; }
.progress i.p25 { width: 25%; }
.progress i.p30 { width: 30%; }
.progress i.p35 { width: 35%; }
.progress i.p40 { width: 40%; }
.progress i.p45 { width: 45%; }
.progress i.p50 { width: 50%; }
.progress i.p55 { width: 55%; }
.progress i.p60 { width: 60%; }
.progress i.p65 { width: 65%; }
.progress i.p70 { width: 70%; }
.progress i.p75 { width: 75%; }
.progress i.p80 { width: 80%; }
.progress i.p85 { width: 85%; }
.progress i.p90 { width: 90%; }
.progress i.p95 { width: 95%; }
.progress i.p100 { width: 100%; }

.agent-value {
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.empty-state {
  padding: 48px 20px;
  color: #627087;
  text-align: center;
}

.empty-state.compact {
  padding: 24px 16px 30px;
  font-size: 11px;
}

.suggestions {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  z-index: 30;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #141923;
  box-shadow: var(--shadow);
}

.suggestion {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 11px 13px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: #d6dce5;
  cursor: pointer;
  text-align: left;
}

.suggestion:hover {
  background: var(--surface-3);
}

.suggestion small {
  color: var(--muted);
}

dialog {
  width: min(440px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 28px 90px #000;
}

dialog::backdrop {
  background: rgba(2, 4, 8, 0.72);
  backdrop-filter: blur(6px);
}

.dialog-card {
  padding: 25px;
}

.dialog-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.dialog-card input {
  width: 100%;
  padding: 0 13px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 18px;
}

.dialog-actions .ghost-button {
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .brand {
    justify-content: center;
    padding: 0;
  }

  .brand > span:last-child,
  .nav-item > span:last-child,
  .sidebar .ghost-button > span:last-child,
  .privacy-note {
    display: none;
  }

  .nav-item,
  .sidebar .ghost-button {
    justify-content: center;
    padding: 0;
  }

  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .search-form {
    width: 100%;
  }

  .top-status {
    justify-content: space-between;
  }

  .content {
    padding: 14px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .side-column {
    grid-row: 2;
  }

  .team-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .search-form {
    display: grid;
    grid-template-columns: 1fr 84px;
  }

  .search-wrap {
    grid-column: 1 / -1;
  }

  .hero-card {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .season-heading {
    justify-items: start;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .agent-grid {
    grid-template-columns: 1fr;
  }
}
