@font-face {
  font-family: "Inter";
  src:
    url("./fonts/Inter-VariableFont_opsz,wght.ttf") format("truetype"),
    url("./fonts/Inter-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Bebas Neue Cyrillic";
  src:
    url("./fonts/bebasneuecyrillic.ttf") format("truetype"),
    url("./fonts/BebasNeue-Cyrillic-Regular.ttf") format("truetype"),
    url("./fonts/BebasNeue-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  --ink: #2c3137;
  --stone: #767676;
  --stone-light: #9aa1a9;
  --paper: #ffffff;
  --canvas: #f4f5f7;
  --bg: #eef0f3;
  --green: #166534;
  --red: #9f1239;
  --line: rgba(44, 49, 55, 0.22);
  --line-strong: rgba(44, 49, 55, 0.34);
  --shadow: 0 24px 60px rgba(44, 49, 55, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", sans-serif;
}

body {
  margin: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: url("./bg.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(255, 255, 255, 0.38);
  pointer-events: none;
}

button {
  font: inherit;
}

.shell {
  padding: 34px 36px 48px;
}

.page-head {
  display: grid;
  grid-template-columns: minmax(480px, 0.72fr) minmax(360px, 0.28fr);
  gap: 36px;
  align-items: start;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 24px;
}

.kicker,
.control-label {
  margin: 0 0 10px;
  color: var(--stone);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  font-family: "Bebas Neue Cyrillic", sans-serif;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--ink);
}

h1 {
  margin: 0;
  font-size: clamp(4.6rem, 8vw, 7.5rem);
  line-height: 0.84;
}

h2 {
  margin: 0;
  font-size: 2.15rem;
  line-height: 0.9;
}

.intro {
  align-self: start;
  margin: 0;
  transform: none;
  max-width: 620px;
  color: rgba(44, 49, 55, 0.78);
  font-size: 16px;
  line-height: 1.55;
}

.telegram-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 18px;
  border: 1px solid rgba(44, 49, 55, 0.34);
  background: rgba(255, 255, 255, 0.22);
  color: var(--ink);
  padding: 10px 12px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition:
    transform 180ms ease,
    background 180ms ease,
    color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.telegram-link svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: currentColor;
}

.telegram-link:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 14px 30px rgba(44, 49, 55, 0.18);
  transform: translateY(-2px);
}

.dashboard-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(to right, var(--ink), rgba(44, 49, 55, 0.18));
}

.controls {
  display: block;
  margin: 22px 0 18px;
  border: 1px solid rgba(44, 49, 55, 0.2);
  background: rgba(255, 255, 255, 0.44);
  backdrop-filter: blur(10px);
  padding: 16px;
  box-shadow: 0 18px 44px rgba(44, 49, 55, 0.05);
}

.dropzone {
  display: grid;
  gap: 10px;
  width: min(100%, 340px);
}

.group-chip,
.action-button {
  border: 1px solid rgba(44, 49, 55, 0.3);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.22);
  color: var(--ink);
  cursor: grab;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition:
    transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
}

.group-chip[aria-grabbed="true"],
.group-chip:hover,
.action-button:hover {
  border-color: var(--ink);
  background: rgba(255, 255, 255, 0.62);
  transform: translateY(-2px);
}

.group-chip.is-dragging {
  opacity: 0.58;
  box-shadow: 0 16px 36px rgba(44, 49, 55, 0.16);
  transform: scale(1.015);
}

.group-chip::before {
  content: "☰";
  margin-right: 9px;
  color: var(--stone);
}

.toolbar {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.action-button {
  cursor: pointer;
  font-family: "Bebas Neue Cyrillic", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.dashboard-panel {
  position: relative;
  border: 1px solid rgba(44, 49, 55, 0.2);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.table-meta {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line);
}

.table-meta p {
  margin: 0;
  color: var(--stone);
  font-size: 12px;
}

.table-wrap {
  overflow: auto;
  height: calc(100vh - 250px);
  min-height: 650px;
}

table {
  width: 100%;
  min-width: 1726px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 12px;
}

th,
td {
  border-right: 1px solid rgba(44, 49, 55, 0.14);
  border-bottom: 1px solid rgba(44, 49, 55, 0.12);
  padding: 8px 9px;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f8f9fa;
  color: rgba(44, 49, 55, 0.82);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-align: left;
  text-transform: uppercase;
}

thead tr:nth-child(2) th {
  top: 34px;
  z-index: 5;
  background: #f2f4f6;
}

thead tr:nth-child(2) th.code-subhead {
  height: 22px;
  padding-top: 0;
  padding-bottom: 0;
}

th.sortable {
  cursor: pointer;
}

th.sortable:hover {
  background: #e8ebee;
}

th.is-sort::after {
  content: attr(data-dir);
  margin-left: 6px;
  color: var(--ink);
}

.code-cell {
  width: 44px;
  color: rgba(44, 49, 55, 0.72);
  font-variant-numeric: tabular-nums;
  text-align: center;
  border-right: 0;
  padding-left: 2px;
  padding-right: 2px;
}

.code-group {
  text-align: center;
  border-right: 0;
}

.code-medium {
  width: 66px;
}

.code-last {
  border-right: 1px solid rgba(44, 49, 55, 0.24);
}

.name-cell {
  min-width: 340px;
  width: 370px;
}

th.name-cell {
  text-align: center;
}

.metric-cell {
  width: 86px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.pct-cell {
  width: 120px;
}

.bar-cell {
  width: 450px;
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover {
  background: rgba(44, 49, 55, 0.06);
}

.level-0 {
  background: rgba(44, 49, 55, 0.08);
  font-weight: 760;
}

.fixed-row {
  background: rgba(44, 49, 55, 0.1);
}

.fixed-parent {
  background: rgba(44, 49, 55, 0.14);
  font-weight: 860;
}

.fixed-parent .row-title {
  text-transform: uppercase;
}

.level-1 {
  background: rgba(44, 49, 55, 0.045);
  font-weight: 690;
}

.level-2 {
  background: rgba(154, 161, 169, 0.12);
}

.level-3 {
  background: rgba(154, 161, 169, 0.07);
}

.level-4,
.level-5,
.level-6,
.level-7 {
  background: rgba(255, 255, 255, 0.92);
}

.name-inner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.35;
}

.toggle {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 1px solid rgba(44, 49, 55, 0.28);
  background: rgba(255, 255, 255, 0.4);
  color: var(--ink);
  cursor: pointer;
  line-height: 18px;
  text-align: center;
}

.toggle.placeholder {
  border-color: transparent;
  background: transparent;
  cursor: default;
}

.row-title {
  display: block;
}

.bar-track {
  position: relative;
  height: 30px;
  border: 1px solid rgba(44, 49, 55, 0.22);
  background: rgba(44, 49, 55, 0.05);
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  min-width: 1px;
  background: linear-gradient(90deg, rgba(44, 49, 55, 0.82), rgba(44, 49, 55, 0.42));
}

.bar-label,
.bar-max {
  position: absolute;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 760;
  white-space: nowrap;
}

.bar-label {
  left: 8px;
  color: #fff;
  max-width: calc(var(--bar-width) - 12px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-label.outside {
  color: var(--ink);
  left: min(calc(var(--bar-width) + 8px), calc(100% - 126px));
  max-width: 96px;
}

.bar-max {
  right: 8px;
  padding-left: 8px;
  background: linear-gradient(90deg, rgba(244, 245, 247, 0), rgba(244, 245, 247, 0.96) 24%);
  color: rgba(44, 49, 55, 0.62);
}

.positive {
  color: var(--green);
  font-weight: 760;
}

.negative {
  color: var(--red);
  font-weight: 760;
}

.muted {
  color: var(--stone);
}

.empty {
  color: rgba(44, 49, 55, 0.3);
}

@media (max-width: 760px) {
  .shell {
    padding: 18px 14px 28px;
  }

  .page-head {
    grid-template-columns: 1fr;
    gap: 12px;
    padding-bottom: 18px;
  }

  h1 {
    font-size: clamp(3.1rem, 18vw, 4.6rem);
    line-height: 0.86;
  }

  h2 {
    font-size: 1.72rem;
  }

  .intro {
    margin-top: 0;
    align-self: auto;
    max-width: 100%;
    font-size: 14px;
    line-height: 1.45;
  }

  .telegram-link {
    width: 100%;
    justify-content: center;
    margin-top: 14px;
    padding: 11px 10px;
    font-size: 10px;
    letter-spacing: 0.1em;
  }

  .controls {
    margin: 16px 0;
    padding: 14px;
  }

  .dropzone {
    width: 100%;
  }

  .group-chip,
  .action-button {
    width: 100%;
    min-height: 40px;
    padding: 10px;
    font-size: 11px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .table-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 16px 14px 12px;
  }

  .table-meta p {
    font-size: 11px;
  }

  .table-wrap {
    height: calc(100svh - 392px);
    min-height: 470px;
  }

  table {
    min-width: 1726px;
    font-size: 11px;
  }

  th {
    font-size: 9px;
  }

  td {
    padding-top: 7px;
    padding-bottom: 7px;
  }
}
