:root {
  --db-navy: #0b1020;
  --db-mid: #16223a;
  --db-teal: #1f5f63;
  --db-teal-soft: #e8f3f5;
  --db-bg: #eff4fa;
  --db-panel: #ffffff;
  --db-line: #d7e0ea;
  --db-text-soft: #4c6079;
  --db-shadow: 0 16px 34px rgba(11, 16, 32, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body.dashboard-shell {
  min-height: 100vh;
  background: radial-gradient(circle at 12% -6%, #e5f6f8 0%, #eef4fa 45%, #e8eef7 100%);
  color: var(--db-mid);
  font-family: Inter, Segoe UI, Arial, sans-serif;
  position: relative;
  overflow-wrap: anywhere;
  word-break: break-word;
}

body.dashboard-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image:
    radial-gradient(rgba(26, 68, 88, 0.042) 0.8px, transparent 0.8px),
    radial-gradient(rgba(26, 68, 88, 0.03) 0.8px, transparent 0.8px);
  background-size: 4px 4px, 7px 7px;
  background-position: 0 0, 2px 3px;
  opacity: 0.4;
}

.dash-main {
  width: min(1160px, 100%);
  margin: 0 auto;
  padding: 0 16px 46px;
  display: grid;
  gap: 14px;
}

.dash-hero {
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  color: #f4fcff;
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 255, 255, 0.16), transparent 44%),
    linear-gradient(162deg, #13353f 0%, #1f5f63 56%, #2a7987 100%);
  box-shadow: var(--db-shadow);
  padding: 22px 20px;
  position: relative;
  overflow: hidden;
}

.dash-hero::after {
  content: "";
  position: absolute;
  inset: -30% -10%;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.16) 50%, transparent 70%);
  animation: dashHeroSweep 6.4s ease-in-out infinite;
  pointer-events: none;
}

.dash-eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #cae9ed;
}

.dash-hero h1 {
  margin: 8px 0 0;
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.013em;
}

.dash-hero p {
  margin: 8px 0 0;
  font-size: clamp(14px, 1.4vw, 18px);
  color: #d7edf2;
  max-width: 72ch;
}

.dash-battle-strip {
  border: 1px solid #d3e0eb;
  border-radius: 14px;
  background: linear-gradient(165deg, #ffffff 0%, #f3f9ff 100%);
  padding: 10px;
  box-shadow: 0 8px 18px rgba(11, 16, 32, 0.08);
}

.dash-battle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.dash-battle-chip {
  border: 1px solid #d8e4ef;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
  min-width: 0;
}

.dash-battle-chip p {
  margin: 0;
}

.dash-battle-chip .k {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #56718b;
}

.dash-battle-chip .v {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 900;
  color: #113a52;
  line-height: 1;
}

.dash-grid {
  display: grid;
  gap: 12px;
}

.dash-grid.two-col {
  grid-template-columns: 1.1fr 0.9fr;
}

.dash-grid.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  border: 1px solid var(--db-line);
  border-radius: 16px;
  background: var(--db-panel);
  box-shadow: 0 10px 24px rgba(11, 16, 32, 0.08);
  padding: 14px;
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #1f5f63, #4db7c1, #c79a2f);
  opacity: 0.7;
  pointer-events: none;
}

.panel h2 {
  margin: 0;
  font-size: 24px;
  color: #13304d;
}

.panel-sub {
  margin: 6px 0 0;
  color: var(--db-text-soft);
  font-size: clamp(13px, 1.3vw, 16px);
}

.agent-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid #c6d9e0;
  border-radius: 14px;
  background: linear-gradient(160deg, #f9feff 0%, #eef7fb 100%);
  padding: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75);
}

.agent-avatar {
  width: 76px;
  height: 76px;
  display: inline-flex;
}

.gs-avatar-frame {
  position: relative;
  width: var(--avatar-size);
  height: var(--avatar-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gs-avatar-glow {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--avatar-accent) 42%, transparent), transparent 72%);
  filter: blur(8px);
}

.gs-avatar-ring {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  background: conic-gradient(from 120deg, color-mix(in srgb, var(--avatar-accent) 85%, #fff) 0deg, transparent 130deg, color-mix(in srgb, var(--avatar-accent) 90%, #fff) 250deg, transparent 360deg);
  animation: dbAvatarRingSpin 5.2s linear infinite;
}

.gs-avatar-img {
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 999px;
  border: 2px solid color-mix(in srgb, var(--avatar-accent) 76%, #ffffff);
  object-fit: cover;
  position: relative;
  z-index: 1;
  background: #eaf1f7;
}

.gs-avatar-rank {
  position: absolute;
  right: -2px;
  bottom: -2px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid #fff;
  background: color-mix(in srgb, var(--avatar-accent) 84%, #102037);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.gs-avatar-tier-legend .gs-avatar-glow {
  filter: blur(10px) saturate(1.2);
}

.agent-name {
  margin: 0;
  font-size: 22px;
  color: #173a57;
}

.agent-rank {
  margin: 5px 0 0;
  color: #2d5e7e;
  font-weight: 700;
}

.agent-metric {
  text-align: right;
}

.agent-metric strong {
  display: block;
  color: #143d51;
  font-size: 28px;
  line-height: 1;
}

.agent-metric span {
  color: #4d6a84;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.chip-row {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid #cad8e8;
  background: #f4f8fc;
  border-radius: 999px;
  padding: 5px 9px;
  color: #3d5974;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #f7fbff, #eef5fb);
}

.progress-group {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.progress-item {
  border: 1px solid #dae5f2;
  border-radius: 12px;
  padding: 9px;
  background: #fafcff;
}

.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #2b4e6d;
  font-weight: 700;
  font-size: 13px;
}

.bar-track {
  margin-top: 6px;
  height: 10px;
  border-radius: 999px;
  background: #e3edf7;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #1f5f63 0%, #43a1ac 100%);
  transition: width 0.3s ease;
}

.rule-bars {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.rule-row {
  border: 1px solid #d9e4f1;
  border-radius: 10px;
  background: #fbfdff;
  padding: 8px;
}

.rule-row-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #294b68;
}

.recommend-list,
.activity-list,
.suggestion-list {
  margin: 10px 0 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.recommend-card,
.activity-card,
.suggestion-card {
  border: 1px solid #d9e4ef;
  border-radius: 11px;
  padding: 10px;
  background: #f9fcff;
}

.recommend-card a,
.activity-card a,
.suggestion-card a {
  display: inline-flex;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1f5f63;
  text-decoration: none;
}

.recommend-card a:hover,
.activity-card a:hover,
.suggestion-card a:hover {
  text-decoration: underline;
}

.mission-map {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mission-card {
  border: 1px solid #d8e4f0;
  border-radius: 12px;
  background: #fff;
  padding: 9px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.mission-card:hover {
  transform: translateY(-2px);
  border-color: #b8d0e1;
  box-shadow: 0 10px 18px rgba(11, 16, 32, 0.1);
}

.mission-card h3 {
  margin: 0;
  font-size: 15px;
  color: #163851;
}

.status-pill {
  margin-top: 6px;
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid #cad9e8;
  background: #f5f9fd;
  color: #476784;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-pill.completed {
  border-color: #bde2d5;
  background: #eefaf4;
  color: #1d6957;
}

.status-pill.in-progress {
  border-color: #c9ddf2;
  background: #f1f7ff;
  color: #34587d;
}

.status-pill.locked {
  border-color: #e2d3b6;
  background: #fdf8ef;
  color: #6e5720;
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.btn-primary,
.btn-soft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-primary {
  background: linear-gradient(180deg, #2d8b92 0%, #1f5f63 100%);
  color: #fff;
  border-color: #16484b;
  box-shadow: 0 8px 16px rgba(31, 95, 99, 0.25);
}

.btn-soft {
  background: #f4f8fc;
  border-color: #cedcea;
  color: #264965;
}

.btn-primary:hover,
.btn-soft:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(11, 16, 32, 0.13);
}

.leader-table {
  margin-top: 10px;
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.leader-table th,
.leader-table td {
  border-bottom: 1px solid #e1e8f1;
  padding: 8px 6px;
  text-align: left;
  color: #2d4d6a;
  overflow-wrap: anywhere;
}

.leader-table tbody tr:nth-child(1) td {
  background: linear-gradient(90deg, rgba(238, 252, 247, 0.9), rgba(255, 255, 255, 0.95));
}

.leader-table tbody tr:nth-child(2) td {
  background: linear-gradient(90deg, rgba(242, 247, 255, 0.9), rgba(255, 255, 255, 0.95));
}

.leader-table tbody tr:nth-child(3) td {
  background: linear-gradient(90deg, rgba(255, 248, 238, 0.9), rgba(255, 255, 255, 0.95));
}

.leader-table th {
  color: #5a7390;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
}

.table-avatar {
  width: 34px;
  height: 34px;
  display: inline-flex;
}

.empty-note {
  margin-top: 10px;
  border: 1px dashed #c7d7ea;
  border-radius: 12px;
  padding: 10px;
  background: #f6fbff;
  color: #4e6b86;
}

.input-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.input-row input,
.input-row select {
  border: 1px solid #ccd9e6;
  border-radius: 10px;
  min-height: 38px;
  padding: 0 10px;
  color: #1f3953;
  background: #fff;
}

.confetti-zone {
  position: relative;
  overflow: hidden;
}

.boss-confetti {
  position: absolute;
  top: 38%;
  left: 50%;
  width: 8px;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(180deg, #4ac7a6 0%, #1f7a66 100%);
  animation: dashConfetti 0.85s ease-out forwards;
}

.boss-confetti:nth-child(odd) {
  background: linear-gradient(180deg, #83c7de 0%, #2e7091 100%);
}

@keyframes dashConfetti {
  from {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 1;
  }
  to {
    transform: translate3d(var(--x), var(--y), 0) rotate(var(--r));
    opacity: 0;
  }
}

@keyframes dashHeroSweep {
  0% {
    transform: translateX(-38%);
    opacity: 0;
  }
  20% {
    opacity: 0.8;
  }
  65% {
    opacity: 0.3;
  }
  100% {
    transform: translateX(44%);
    opacity: 0;
  }
}

@keyframes dbAvatarRingSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 980px) {
  .dash-grid.two-col,
  .dash-grid.three-col {
    grid-template-columns: 1fr;
  }
  .mission-map {
    grid-template-columns: 1fr;
  }
  .btn-row .btn-primary,
  .btn-row .btn-soft {
    width: 100%;
  }
  .dash-battle-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
  .gs-avatar-ring {
    display: none;
  }
  .panel::before {
    opacity: 0.45;
  }
}
