@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap");

:root {
  --bg: #f5f8fa;
  --surface: #ffffff;
  --text: #1d2a36;
  --muted: #5f748a;
  --line: #dbe5f0;
  --accent: #4f7df3;
  --accent-soft: #e8f0ff;
  --col-a: #f7fbff;
  --col-b: #f5fcfa;
  --col-head-a: #e7f0ff;
  --col-head-b: #e6f7f1;
  --row-hover: #e6f1ff;
  --row-hover-strong: #ddeafb;
  --col-hover: #eaf4ff;
  --col-hover-head: #ddeafb;
  --shadow: 0 14px 42px rgba(31, 55, 84, 0.12);
  --radius-lg: 22px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(79, 125, 243, 0.16), transparent 32%),
    radial-gradient(circle at 88% 10%, rgba(88, 186, 160, 0.14), transparent 36%),
    radial-gradient(circle at 78% 84%, rgba(249, 186, 116, 0.14), transparent 32%),
    linear-gradient(150deg, #f9fcff 0%, #f1f6fb 52%, #f8fbfd 100%);
}

.page {
  width: min(1220px, 100% - 32px);
  margin: 42px auto;
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.93));
  border: 1px solid rgba(214, 224, 238, 0.86);
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(6px);
}

.card__header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.kicker {
  margin: 0 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #57779c;
}

.kicker-logo {
  width: 14px;
  height: 14px;
  object-fit: contain;
  flex: 0 0 14px;
}

h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.2vw, 1.95rem);
  letter-spacing: -0.02em;
}

.subtle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

button {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #4f7df3 0%, #5c8ef8 100%);
  color: white;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
  box-shadow: 0 8px 20px rgba(79, 125, 243, 0.28);
}

button:hover:enabled {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(79, 125, 243, 0.34);
}

button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.metric-block {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 14px 8px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
}

.chart-block {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
}

.chart-block__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.chart-block__head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  color: #435a70;
}

.chart-canvas {
  width: 100%;
  height: 360px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff, #f7fbff);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 980px;
}

th,
td {
  text-align: center;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid #e4ebf3;
  padding: 12px 10px;
  transition: background-color 0.16s ease, color 0.16s ease;
}

th {
  color: #4d6378;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--col-head-a);
}

td {
  font-size: 1.08rem;
  font-weight: 700;
  color: #1f2d3a;
}

th.metric-head,
td.metric-name {
  text-align: left;
  min-width: 340px;
  width: 340px;
  position: sticky;
  left: 0;
  z-index: 1;
  padding-left: 14px;
}

th.metric-head {
  z-index: 2;
  background: #e4edfb;
  color: #3d546a;
  border-right: 1px solid #d2deef;
}

.metric-head-content {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  width: 100%;
}

.show-all-eye-button {
  all: unset;
  box-sizing: border-box;
  width: 12px;
  height: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4f7df3;
  cursor: pointer;
  opacity: 0.92;
  transition: color 0.16s ease, opacity 0.16s ease, transform 0.16s ease;
}

.show-all-eye-button svg {
  width: 12px;
  height: 12px;
  display: block;
}

.show-all-eye-button path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.show-all-eye-button:hover:not(:disabled) {
  transform: translateY(-0.5px);
}

.show-all-eye-button:disabled {
  color: #9aa9b8;
  opacity: 0.56;
  cursor: not-allowed;
}

.show-all-eye-button.is-active {
  color: #4f7df3;
  opacity: 1;
}

td.metric-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #42566a;
  background: #f2f7ff;
  border-right: 1px solid #dae4f2;
  cursor: pointer;
  white-space: normal;
}

.metric-content {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  width: 100%;
}

.metric-title {
  line-height: 1.2;
  min-width: 0;
  overflow-wrap: anywhere;
}

.row-indicator {
  all: unset;
  box-sizing: border-box;
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--series-color, #8ca2b8);
  background: transparent;
  flex: 0 0 12px;
  cursor: pointer;
  transition: transform 0.16s ease, background-color 0.16s ease, opacity 0.16s ease;
}

.row-indicator.is-active {
  background: var(--series-color, #8ca2b8);
  border-color: var(--series-color, #8ca2b8);
  box-shadow: none;
}

.row-indicator.is-hidden {
  opacity: 0.46;
}

.row-indicator:hover {
  transform: scale(1.12);
}

tbody tr.series-hidden td.metric-name {
  color: #7f92a6;
}

th.total-col,
td.total-col {
  font-weight: 700;
  background: #eef4fb;
  border-left: 2px solid #d6e1ee;
}

thead th:first-child {
  border-top-left-radius: 10px;
}

thead th:last-child {
  border-top-right-radius: 10px;
  border-right: none;
}

thead th:not(.metric-head):nth-child(2n) {
  background: var(--col-head-a);
}

thead th:not(.metric-head):nth-child(2n + 1) {
  background: var(--col-head-b);
}

tbody td:not(.metric-name):nth-child(2n) {
  background: var(--col-a);
}

tbody td:not(.metric-name):nth-child(2n + 1) {
  background: var(--col-b);
}

tbody td:last-child {
  border-right: none;
}

tbody tr[data-series-name] {
  cursor: pointer;
}

tbody tr:hover td:not(.metric-name),
tbody tr:focus-within td:not(.metric-name) {
  background: var(--row-hover);
}

tbody tr:hover td.metric-name,
tbody tr:focus-within td.metric-name {
  background: var(--row-hover-strong);
}

thead th.is-col-hover {
  background: var(--col-hover-bg, var(--col-hover-head)) !important;
}

tbody td.is-col-hover,
tbody tr:hover td.is-col-hover,
tbody tr:focus-within td.is-col-hover {
  background: var(--col-hover-bg, var(--col-hover)) !important;
}

.status {
  margin: 14px 4px 0;
  font-size: 0.92rem;
  color: #45566a;
}

.status.error {
  color: #a32020;
}

@media (max-width: 900px) {
  .page {
    width: min(1220px, 100% - 18px);
    margin: 18px auto;
  }

  .card {
    border-radius: 16px;
    padding: 16px;
  }

  .card__header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .actions {
    align-items: flex-start;
  }

  button {
    width: fit-content;
  }

  .chart-block {
    padding: 12px;
  }

  .chart-block__head {
    flex-wrap: wrap;
  }

  .chart-canvas {
    height: 300px;
  }
}
