:root {
  --bg: #f4f8fc;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-solid: #ffffff;
  --panel-soft: #eef5fb;
  --panel-soft-2: #f8fbff;
  --panel-vibrant: linear-gradient(135deg, rgba(22, 120, 242, 0.1), rgba(31, 196, 143, 0.08), rgba(255, 176, 46, 0.08));
  --line: rgba(22, 44, 76, 0.08);
  --text: #10233f;
  --muted: #60738e;
  --accent: #1678f2;
  --accent-2: #1fc48f;
  --accent-3: #ffb02e;
  --accent-4: #f26666;
  --shadow: 0 20px 50px rgba(46, 86, 138, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(22, 120, 242, 0.12), transparent 24%),
    radial-gradient(circle at top right, rgba(31, 196, 143, 0.1), transparent 20%),
    linear-gradient(180deg, #f8fbff 0%, #f3f8fd 48%, #eef5fb 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(20, 53, 92, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 53, 92, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent);
}

.page-shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 36px;
}

.announcement-bar {
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid rgba(22, 120, 242, 0.16);
  background: linear-gradient(135deg, rgba(22, 120, 242, 0.1), rgba(31, 196, 143, 0.08), rgba(255, 176, 46, 0.1));
  color: var(--text);
  box-shadow: 0 14px 32px rgba(31, 66, 117, 0.08);
  line-height: 1.6;
  font-size: 0.94rem;
}

.announcement-bar strong {
  margin-right: 8px;
  flex: 0 0 auto;
}

.announce-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(22, 44, 76, 0.08);
  color: var(--text);
  font-size: 0.84rem;
  white-space: normal;
}

.hero {
  display: grid;
  grid-template-columns: 1.5fr 0.95fr;
  gap: 24px;
  align-items: stretch;
}

.hero-copy,
.hero-panel,
.card,
.footer {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(249, 252, 255, 0.9));
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.card:hover,
.hero-copy:hover,
.hero-panel:hover,
.footer:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 60px rgba(46, 86, 138, 0.16);
  border-color: rgba(22, 120, 242, 0.16);
}

.hero-copy {
  padding: 42px;
  border-radius: 30px;
  position: relative;
  overflow: hidden;
}

.hero-copy::after {
  content: "";
  position: absolute;
  right: -48px;
  top: -48px;
  width: 180px;
  height: 180px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(22, 120, 242, 0.18), transparent 68%);
  pointer-events: none;
}

.eyebrow,
.section-label,
.panel-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 18px 0 16px;
  max-width: 10ch;
  font-size: clamp(2.5rem, 5vw, 4.9rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
}

.hero-copy p {
  max-width: 60ch;
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

.upload-button,
select {
  border: 0;
  border-radius: 16px;
  font: inherit;
}

.upload-button {
  padding: 14px 20px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease;
}

.upload-button {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), #4a8cff, #17c796);
  box-shadow: 0 16px 36px rgba(22, 120, 242, 0.28);
}

.upload-button:hover,
select:hover {
  transform: translateY(-2px);
}

.hero-panel {
  padding: 28px;
  border-radius: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
}

.hero-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.status-pill {
  padding: 8px 12px;
  border-radius: 999px;
  color: #0d2848;
  background: linear-gradient(135deg, #c9f3e5, #fff0cb);
  font-size: 0.82rem;
  font-weight: 800;
}

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

.hero-stats div {
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff, #f4f9fe);
  border: 1px solid rgba(22, 44, 76, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 10px 28px rgba(31, 66, 117, 0.06);
}

.hero-stats span,
.panel-note,
#datasetSummary,
.insight-text,
tbody td,
.footer p {
  color: var(--muted);
}

.hero-stats strong {
  display: block;
  margin-top: 8px;
  font-size: 1.3rem;
}

#csvUpload {
  width: 100%;
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(22, 44, 76, 0.18);
  background: rgba(244, 248, 252, 0.9);
  color: var(--muted);
}

.panel-note {
  margin: 0;
  font-size: 0.94rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
  margin-top: 24px;
}

.card {
  grid-column: span 6;
  padding: 26px;
  border-radius: 26px;
}

.wide-card {
  grid-column: 1 / -1;
}

.kpi-section {
  grid-column: span 6;
}

.highlights-card {
  grid-column: span 3;
}

.leaderboard-card {
  grid-column: span 3;
  background: var(--panel-vibrant);
  border-color: rgba(22, 120, 242, 0.12);
}

.insights-card {
  grid-column: span 12;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.section-head h2 {
  margin: 8px 0 0;
  font-size: 1.45rem;
}

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

.highlights-grid {
  display: grid;
  gap: 16px;
}

.kpi-card {
  padding: 18px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 255, 0.96)),
    var(--panel-solid);
  border: 1px solid rgba(22, 44, 76, 0.06);
  box-shadow: 0 12px 28px rgba(31, 66, 117, 0.08);
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: "";
  position: absolute;
  inset: auto -30px -30px auto;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(22, 120, 242, 0.12), transparent 70%);
}

.kpi-card span {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
}

.kpi-card strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  letter-spacing: -0.03em;
}

.kpi-card small {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent-2);
}

.progress-panel {
  display: grid;
  gap: 16px;
}

.progress-card {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(22, 44, 76, 0.07);
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  box-shadow: 0 12px 28px rgba(31, 66, 117, 0.08);
}

.progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.progress-title {
  font-size: 0.96rem;
  font-weight: 700;
}

.progress-value {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 800;
}

.progress-copy {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.92rem;
}

.progress-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(20, 53, 92, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #57a0ff, var(--accent-2));
  animation: progressGrow 1.1s ease forwards;
  transform-origin: left center;
}

.placeholder-card,
.empty-state {
  border: 1px dashed rgba(22, 44, 76, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(243, 248, 253, 0.9));
}

.placeholder-card strong,
.empty-state h3 {
  color: var(--text);
}

.placeholder-card small,
.empty-state p {
  color: var(--muted);
}

.chart {
  min-height: 340px;
}

.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 220px) 1fr 128px;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--panel-soft-2);
  border: 1px solid rgba(22, 44, 76, 0.06);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.bar-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(31, 66, 117, 0.08);
  border-color: rgba(22, 120, 242, 0.14);
}

.bar-label {
  display: grid;
  gap: 4px;
  font-weight: 700;
  font-size: 0.94rem;
}

.bar-label small {
  color: var(--muted);
  font-weight: 600;
}

.bar-track {
  position: relative;
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(20, 53, 92, 0.08);
}

.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #588dff, var(--accent-2));
  animation: progressGrow 1s ease forwards;
  transform-origin: left center;
}

.alt-fill {
  background: linear-gradient(90deg, #6f7dff, #a85dff);
}

.warm-fill {
  background: linear-gradient(90deg, #ffb02e, #ff7b54);
}

.chart-multi {
  display: grid;
  gap: 10px;
}

.chart-stack {
  display: grid;
  gap: 6px;
}

.chart-stack span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.bar-value {
  text-align: right;
  color: var(--muted);
  font-weight: 700;
}

.empty-state {
  min-height: 340px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 28px;
}

.empty-state h3 {
  margin: 0 0 10px;
  font-size: 1.15rem;
}

.empty-state p {
  margin: 0;
  max-width: 36ch;
  line-height: 1.7;
}

.chart-donut {
  display: grid;
  place-items: center;
}

.donut-wrap {
  display: grid;
  gap: 24px;
  justify-items: center;
}

.donut-svg {
  width: min(320px, 100%);
  height: auto;
  overflow: visible;
}

.donut-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  width: 100%;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.legend-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.9rem;
}

.table-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

select {
  padding: 12px 14px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid rgba(22, 44, 76, 0.12);
}

.table-wrap {
  overflow: auto;
  border-radius: 20px;
  border: 1px solid rgba(22, 44, 76, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.leaderboard-section {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 250, 255, 0.96));
}

.leaderboard-list {
  display: grid;
  gap: 12px;
}

.leader-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(22, 44, 76, 0.08);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.leader-item:hover {
  transform: translateX(4px);
  box-shadow: 0 16px 28px rgba(31, 66, 117, 0.08);
}

.leader-rank {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), #5f8dff);
}

.leader-meta {
  min-width: 0;
}

.leader-meta strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leader-meta span,
.leader-score {
  color: var(--muted);
  font-size: 0.88rem;
}

.leader-score strong {
  display: block;
  color: var(--text);
  font-size: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1000px;
  background: rgba(255, 255, 255, 0.72);
}

thead th {
  padding: 16px 14px;
  text-align: left;
  font-size: 0.84rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(239, 246, 252, 0.9);
}

tbody td {
  padding: 16px 14px;
  border-top: 1px solid rgba(22, 44, 76, 0.06);
  font-size: 0.95rem;
  vertical-align: middle;
}

tbody tr:hover {
  background: rgba(22, 120, 242, 0.05);
}

tbody tr {
  transition: background 180ms ease, transform 180ms ease;
}

.campaign-cell {
  display: grid;
  gap: 5px;
}

.campaign-name {
  font-weight: 800;
  color: var(--text);
}

.campaign-sub {
  color: var(--muted);
  font-size: 0.84rem;
}

.metric-bar-cell {
  min-width: 150px;
}

.mini-track {
  margin-top: 8px;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(20, 53, 92, 0.08);
}

.mini-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7db5ff, #5b8eff, #15c792);
  animation: progressGrow 1s ease forwards;
  transform-origin: left center;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.83rem;
  font-weight: 800;
}

.status-chip.enabled {
  color: #0d7357;
  background: rgba(31, 196, 143, 0.14);
}

.status-chip.other {
  color: #7a5a11;
  background: rgba(255, 176, 46, 0.16);
}

.empty-row td {
  text-align: center;
  padding: 34px 14px;
  color: var(--muted);
}

.insight-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.insight {
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 247, 253, 0.98));
  border: 1px solid rgba(22, 44, 76, 0.07);
  box-shadow: 0 12px 28px rgba(31, 66, 117, 0.05);
}

.insight.recommendation {
  background: linear-gradient(135deg, rgba(22, 120, 242, 0.14), rgba(31, 196, 143, 0.12), rgba(255, 176, 46, 0.1));
  border-color: rgba(22, 120, 242, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

@keyframes progressGrow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.insight-title {
  margin: 0 0 8px;
  font-size: 1rem;
}

.insight-text {
  margin: 0;
  line-height: 1.65;
}

.footer {
  margin-top: 24px;
  padding: 22px 26px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer strong {
  display: block;
  margin-bottom: 6px;
}

.footer-main,
.footer-contact {
  display: grid;
  gap: 6px;
}

.footer-contact {
  justify-items: end;
  text-align: right;
}

.footer p {
  margin: 0;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

@media (max-width: 1080px) {
  .hero,
  .kpi-grid,
  .insight-list,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .card,
  .wide-card,
  .kpi-section,
  .leaderboard-card,
  .insights-card {
    grid-column: 1 / -1;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 20px, 1280px);
    padding-top: 16px;
  }

  .hero-copy,
  .hero-panel,
  .card,
  .footer {
    padding: 20px;
    border-radius: 22px;
  }

  .hero-copy h1 {
    max-width: none;
  }

  .section-head,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-contact {
    justify-items: start;
    text-align: left;
  }

  .donut-legend {
    grid-template-columns: 1fr;
  }
}
