:root {
  --purple-100: #270648;
  --purple-80: #4a2273;
  --purple-60: #7b5c96;
  --purple-20: #d7d0df;
  --purple-10: #e5e1e9;
  --white: #ffffff;
  --bg: #f6f4f8;
  --ink: #22192d;
  --muted: #71657e;
  --line: #e8e2ee;
  --deeploy-accent: #6d3fa8;
  --deeploy-accent-light: #b39aca;
  --green: #3fa34d;
  --yellow: #f3b11f;
  --red: #dc3f3f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top right, rgba(74, 34, 115, 0.1), transparent 25%),
    linear-gradient(180deg, #fcfbfd 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: Poppins, "Segoe UI", sans-serif;
}

.shell {
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.hero,
.filters,
.kpis,
.main-grid,
.table-grid,
.compare-grid {
  display: grid;
  gap: 18px;
}

.hero {
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 28px 30px;
  border-radius: 28px;
  background: linear-gradient(135deg, var(--purple-100), #391160 65%, #54227f 100%);
  color: var(--white);
  box-shadow: 0 24px 54px rgba(39, 6, 72, 0.24);
  position: sticky;
  top: 12px;
  z-index: 40;
}

.hero__brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.hero h1,
.panel h2,
.panel h3 {
  margin: 0;
}

.hero h1 {
  font-size: clamp(2rem, 3vw, 2.8rem);
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--purple-80);
}

.eyebrow--light {
  color: rgba(255, 255, 255, 0.72);
}

.button {
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  font: inherit;
  cursor: pointer;
}

.button--ghost {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
}

.filters {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 18px;
  position: sticky;
  top: 138px;
  z-index: 35;
  padding: 10px 0 4px;
  background: linear-gradient(180deg, rgba(252, 251, 253, 0.96), rgba(246, 244, 248, 0.92));
  backdrop-filter: blur(10px);
}

.filter,
.kpi,
.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 22px;
}

.filter {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.filter span,
.kpi span,
.mini-metric span,
.summary-block__label,
.status-card small,
.table-count,
.compare-label {
  color: var(--muted);
}

.filter select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  font: inherit;
  color: var(--ink);
}

.kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
}

.kpi {
  padding: 20px;
  box-shadow: 0 12px 30px rgba(39, 6, 72, 0.05);
}

.kpi strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 2rem;
  color: var(--purple-100);
}

.kpi small {
  display: block;
  line-height: 1.4;
}

.kpi--primary {
  background: linear-gradient(180deg, var(--purple-100), #3d1566);
  border-color: transparent;
}

.kpi--primary span,
.kpi--primary strong,
.kpi--primary small {
  color: var(--white);
}

.main-grid {
  grid-template-columns: 1.8fr 0.9fr;
  margin-top: 18px;
  align-items: start;
}

.main-grid > .panel,
.table-grid > .panel {
  align-self: start;
}

.table-grid {
  grid-template-columns: 1.8fr 0.9fr;
  margin-top: 18px;
}

.panel {
  padding: 22px;
}

.panel__head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
}

.legend-inline {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--muted);
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 7px;
  border-radius: 999px;
}

.legend-dot--primary {
  background: var(--purple-100);
}

.legend-dot--target {
  background: var(--deeploy-accent-light);
}

.trend-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(58px, 1fr);
  gap: 6px;
  align-items: end;
  min-height: 188px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.trend-bar {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 4px;
  justify-items: center;
  min-height: 172px;
  min-width: 0;
}

.trend-bar__value,
.trend-bar__label {
  font-size: 0.78rem;
}

.trend-bar__stage {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: center;
  width: 100%;
  min-height: 132px;
  padding: 0 4px;
  border-radius: 18px;
  background:
    linear-gradient(#f4eff7 1px, transparent 1px) 0 0 / 100% 44px,
    linear-gradient(180deg, #faf8fc 0%, #f3eef8 100%);
}

.trend-bar__target {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 35%;
  border-top: 2px dashed rgba(179, 154, 202, 0.95);
}

.trend-bar__fill {
  position: relative;
  width: 100%;
  border-radius: 14px 14px 6px 6px;
  background: linear-gradient(180deg, #8b63b9 0%, var(--purple-100) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.trend-bar__label {
  line-height: 1.1;
}

.insight-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.insight-card {
  padding: 18px;
  border: 1px solid rgba(39, 6, 72, 0.06);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 245, 252, 0.9));
  box-shadow: 0 14px 32px rgba(39, 6, 72, 0.06);
}

.insight-card span,
.insight-card small {
  color: var(--muted);
}

.insight-card span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
}

.insight-card strong {
  display: block;
  margin-top: 18px;
  font-size: 1.5rem;
  color: var(--purple-100);
}

.insight-card b {
  display: block;
  margin-top: 8px;
  font-size: 1rem;
  color: var(--ink);
}

.insight-card small {
  display: block;
  margin-top: 6px;
  line-height: 1.45;
}

.insight-card--positive b {
  color: var(--green);
}

.insight-card--negative b {
  color: var(--red);
}

.insight-card--purple b {
  color: var(--purple-80);
}

.trend-period {
  margin-top: 10px;
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.assistant-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  background:
    radial-gradient(circle at top center, rgba(139, 99, 185, 0.16), transparent 35%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 244, 251, 0.94));
}

.assistant-panel > .panel__head,
.assistant-panel > .status-list,
.assistant-panel > .summary-block {
  display: none;
}

.assistant-panel__header h2 {
  font-size: 2rem;
}

.assistant-avatar {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 96px;
}

.assistant-avatar__orb {
  width: 112px;
  height: 112px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, #eadfff, #b08ade 55%, #7449ad 100%);
  box-shadow: 0 20px 40px rgba(109, 63, 168, 0.24);
}

.assistant-avatar__face {
  position: absolute;
  width: 74px;
  height: 52px;
  border-radius: 28px;
  background: #2f124f;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.assistant-avatar__face span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.08);
}

.assistant-intro {
  text-align: center;
}

.assistant-intro strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.08rem;
}

.assistant-intro p,
.assistant-disclaimer {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.assistant-questions {
  display: grid;
  gap: 10px;
}

.assistant-question {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(39, 6, 72, 0.08);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.assistant-question:hover {
  transform: translateY(-1px);
  border-color: rgba(109, 63, 168, 0.24);
}

.assistant-question--active {
  border-color: rgba(109, 63, 168, 0.34);
  box-shadow: 0 0 0 2px rgba(109, 63, 168, 0.08);
}

.assistant-response {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(39, 6, 72, 0.06);
}

.assistant-response p {
  margin: 10px 0 0;
  line-height: 1.65;
}

.status-list {
  display: grid;
  gap: 14px;
}

.status-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbf9fd;
  text-align: left;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.status-card:hover {
  transform: translateY(-1px);
}

.status-card__copy {
  display: grid;
  gap: 6px;
}

.status-card__meta {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.status-card__cta {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.status-card:focus-visible {
  outline: 2px solid var(--purple-80);
  outline-offset: 2px;
}

.status-card--active {
  box-shadow: 0 0 0 2px rgba(39, 6, 72, 0.16);
  border-color: rgba(39, 6, 72, 0.18);
}

.status-card--excellent {
  background: linear-gradient(180deg, rgba(39, 6, 72, 0.05), rgba(39, 6, 72, 0.02));
}

.status-card--healthy {
  background: linear-gradient(180deg, rgba(63, 163, 77, 0.06), rgba(63, 163, 77, 0.02));
}

.status-card--attention {
  background: linear-gradient(180deg, rgba(243, 177, 31, 0.08), rgba(243, 177, 31, 0.02));
}

.status-card--risk {
  background: linear-gradient(180deg, rgba(220, 63, 63, 0.08), rgba(220, 63, 63, 0.02));
}

.status-badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.status-badge {
  min-width: 56px;
  padding: 8px 12px;
  border: 0;
  pointer-events: none;
}

.status-badge--excellent {
  background: rgba(39, 6, 72, 0.12);
  color: var(--purple-100);
}

.status-badge--healthy {
  background: rgba(63, 163, 77, 0.12);
  color: var(--green);
}

.status-badge--attention {
  background: rgba(243, 177, 31, 0.14);
  color: #b47a00;
}

.status-badge--risk {
  background: rgba(220, 63, 63, 0.12);
  color: var(--red);
}

.summary-block {
  margin-top: 22px;
  padding: 18px;
  border-radius: 18px;
  background: #f8f6fb;
}

.summary-block p {
  margin: 10px 0 0;
  line-height: 1.6;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  padding: 13px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  position: sticky;
  top: 0;
  background: var(--white);
  color: var(--purple-80);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status-pill {
  padding: 7px 10px;
}

.status-pill--excellent {
  background: rgba(39, 6, 72, 0.12);
  color: var(--purple-100);
}

.status-pill--healthy {
  background: rgba(63, 163, 77, 0.12);
  color: var(--green);
}

.status-pill--attention {
  background: rgba(243, 177, 31, 0.15);
  color: #a86d00;
}

.status-pill--risk {
  background: rgba(220, 63, 63, 0.14);
  color: var(--red);
}

.mini-metrics {
  display: grid;
  gap: 12px;
}

.mini-metric {
  padding: 16px;
  border-radius: 18px;
  background: #f8f6fb;
}

.mini-metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.1rem;
}

.compare-panel {
  margin-top: 18px;
}

.compare-grid {
  grid-template-columns: 1fr;
  gap: 24px;
}

.compare-grid > div {
  width: 100%;
}

.compare-slot {
  width: 100%;
}

.compare-grid h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.compare-card {
  display: grid;
  gap: 12px;
}

.compare-bars {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
  min-height: 260px;
  width: 100%;
}

.compare-item {
  display: grid;
  gap: 6px;
  justify-items: center;
}

.compare-item__stage {
  display: flex;
  align-items: end;
  justify-content: center;
  width: 100%;
  min-height: 220px;
  padding: 0 4px;
  border-radius: 14px;
  background:
    linear-gradient(#f4eff7 1px, transparent 1px) 0 0 / 100% 35px,
    linear-gradient(180deg, #faf8fc 0%, #f4eff8 100%);
}

.compare-item__pair {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 100%;
}

.compare-item__bar {
  width: clamp(18px, 42%, 28px);
  min-height: 4px;
  border-radius: 10px 10px 4px 4px;
  cursor: pointer;
  transition: transform 120ms ease;
}

.compare-item__bar:hover {
  transform: translateY(-1px);
}

.compare-item__value {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.35;
}

.compare-item__value--current {
  color: var(--purple-100);
  font-weight: 700;
}

.compare-item__value--previous {
  color: #8d82a0;
}

.compare-item__delta {
  font-size: 0.68rem;
  font-weight: 700;
}

.compare-item__delta--positive {
  color: var(--green);
}

.compare-item__delta--negative {
  color: var(--red);
}

.compare-item__delta--na {
  display: inline-block;
  min-height: 0.9rem;
}

.compare-item__bar--previous {
  background: #cfc6db;
}

.compare-item__bar--current {
  background: var(--purple-100);
}

.compare-bars--margin .compare-item__stage {
  min-height: 240px;
}

.compare-bars--margin .compare-item__bar--current {
  background: linear-gradient(180deg, #8b63b9 0%, var(--purple-100) 100%);
}

.compare-bars--margin .compare-item__bar--previous {
  background: #d6cede;
}

.compare-bars__legend {
  display: flex;
  gap: 14px;
  font-size: 0.82rem;
  color: var(--muted);
}

.compare-bars__legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 999px;
}

.compare-bars__legend .previous {
  background: #cfc6db;
}

.compare-bars__legend .current {
  background: var(--purple-100);
}

.compare-item__pair {
  width: 100%;
}

.empty-state {
  padding: 22px;
  border-radius: 18px;
  background: #f8f6fb;
  color: var(--muted);
  text-align: center;
}

.chart-tooltip {
  position: fixed;
  z-index: 20;
  max-width: 220px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(39, 6, 72, 0.96);
  color: var(--white);
  font-size: 0.84rem;
  line-height: 1.45;
  box-shadow: 0 16px 30px rgba(39, 6, 72, 0.22);
  pointer-events: none;
}

.chart-tooltip strong {
  display: block;
  margin-bottom: 4px;
}

@media (max-width: 1100px) {
  .filters,
  .kpis,
  .main-grid,
  .table-grid,
  .hero {
    grid-template-columns: 1fr;
  }

  .hero,
  .filters {
    position: static;
  }

  .insight-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .insight-strip {
    grid-template-columns: 1fr;
  }

  .trend-chart,
  .compare-bars {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .compare-item__bar {
    width: clamp(14px, 38%, 22px);
  }
}
