:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --text: #17202a;
  --muted: #637083;
  --line: #d9e0e7;
  --accent: #126d74;
  --accent-2: #7a5c00;
  --good: #217a4b;
  --bad: #b33a3a;
  --shadow: 0 16px 36px rgba(24, 38, 52, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
}

body {
  margin: 0;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(16px, 4vw, 52px) 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

main {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 18px clamp(12px, 3vw, 32px) 44px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.meta span,
.panel-head span {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  background: var(--surface-2);
}

.admin-open {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.admin-open:hover,
.admin-open:focus {
  border-color: var(--accent);
  outline: 0;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 210px);
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.monitor-form {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(220px, 1fr) minmax(190px, 0.75fr) auto;
  gap: 8px;
  grid-column: 1 / -1;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.monitor-form__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.monitor-form__head strong {
  font-size: 16px;
}

.monitor-form__head span {
  color: var(--muted);
  font-size: 12px;
}

.field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  min-width: 0;
}

.monitor-form input,
.monitor-form select,
.monitor-form > button {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--text);
}

.monitor-form input:focus,
.monitor-form select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 109, 116, 0.12);
  outline: 0;
}

.monitor-form > button {
  margin-top: 2px;
  border: 1px solid var(--accent);
  background: #e5f3f3;
  color: #083f43;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.role-field {
  position: relative;
}

.role-picker-button {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 7px 10px;
  text-align: left;
  cursor: pointer;
}

.role-picker-button:hover,
.role-picker-button:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 109, 116, 0.12);
  outline: 0;
}

.role-picker-button strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.role-picker-button span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-picker-button span:empty {
  display: none;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 32, 42, 0.34);
}

.modal__panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  width: min(680px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 30px 70px rgba(24, 38, 52, 0.24);
  padding: 16px;
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal__close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.role-modal-search {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 11px;
  background: var(--surface);
  color: var(--text);
}

.role-modal-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 109, 116, 0.12);
  outline: 0;
}

.role-modal-results {
  overflow: auto;
  max-height: min(520px, calc(100vh - 210px));
  border: 1px solid var(--line);
  border-radius: 8px;
}

.role-option {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.role-option:hover,
.role-option:focus {
  background: #edf7f7;
  outline: 0;
}

.role-option:last-child {
  border-bottom: 0;
}

.role-option strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.role-option span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
}

.admin-modal {
  width: min(900px, 100%);
}

.admin-auth {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.admin-auth input,
.admin-auth button,
.admin-row input,
.admin-row button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

.admin-auth input,
.admin-row input {
  width: 100%;
  padding: 0 10px;
}

.admin-auth button,
.admin-row button {
  padding: 0 12px;
  cursor: pointer;
  font-weight: 700;
}

.admin-auth button,
.admin-row .admin-save {
  border-color: var(--accent);
  background: #e5f3f3;
  color: #083f43;
}

.admin-row .admin-delete {
  border-color: #d9b2b2;
  background: #fbefef;
  color: #842b2b;
}

.admin-row .admin-restore {
  border-color: #c9d9bd;
  background: #f0f7eb;
  color: #315c24;
}

.admin-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  max-height: min(560px, calc(100vh - 230px));
}

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #f7fafb;
  color: var(--muted);
  font-size: 13px;
}

.admin-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 110px 92px 104px;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
}

.admin-row.is-disabled {
  opacity: 0.64;
}

.admin-row__title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.admin-row__title strong,
.admin-row__title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-row__title span {
  color: var(--muted);
  font-size: 12px;
}

.admin-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
}

.role-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  position: relative;
}

button,
input,
select {
  font: inherit;
}

.role-tabs button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 13px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.role-tabs button.active {
  border-color: var(--accent);
  background: #e5f3f3;
  color: #083f43;
  font-weight: 700;
}

.role-tabs button.is-pending {
  border-style: dashed;
}

.role-more {
  position: relative;
}

.role-more__button {
  min-width: 48px;
  font-weight: 700;
}

.role-more__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  overflow: auto;
  width: min(360px, 86vw);
  max-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 20px 44px rgba(24, 38, 52, 0.18);
  padding: 6px;
}

.role-tabs .role-more__item {
  display: block;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  text-align: left;
}

.role-tabs .role-more__item:hover,
.role-tabs .role-more__item:focus {
  background: #edf7f7;
  outline: 0;
}

.search,
.select {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.search input,
.select select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--text);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi {
  min-height: 96px;
  padding: 16px;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.kpi strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.kpi em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  margin-top: 8px;
}

.grid {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.grid-primary {
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.85fr);
}

.grid-secondary {
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
}

.panel {
  min-width: 0;
  padding: 16px;
}

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

.panel-head span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

canvas {
  display: block;
  width: 100%;
  max-width: 100%;
}

canvas.is-interactive {
  cursor: crosshair;
}

.chart-tooltip {
  position: fixed;
  z-index: 80;
  display: grid;
  gap: 3px;
  max-width: min(260px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 34px rgba(24, 38, 52, 0.18);
  color: var(--text);
  font-size: 12px;
  pointer-events: none;
}

.chart-tooltip[hidden] {
  display: none;
}

.chart-tooltip strong,
.chart-tooltip span,
.chart-tooltip em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-tooltip span {
  font-weight: 700;
}

.chart-tooltip em {
  color: var(--muted);
  font-style: normal;
}

#competencyChart {
  height: 360px;
}

#salaryChart {
  height: 260px;
}

.history-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

#tagVacancyChart,
#tagSalaryChart {
  height: 240px;
}

.trend-list {
  display: grid;
  gap: 8px;
}

.trend-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.trend-item:last-child {
  border-bottom: 0;
}

.trend-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.trend-meta {
  color: var(--muted);
  font-size: 12px;
}

.delta {
  min-width: 54px;
  border-radius: 6px;
  padding: 5px 7px;
  text-align: right;
  font-weight: 700;
}

.delta.good {
  background: #e7f4ed;
  color: var(--good);
}

.delta.bad {
  background: #faeaea;
  color: var(--bad);
}

.delta.flat {
  background: var(--surface-2);
  color: var(--muted);
}

.keyword-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-content: flex-start;
  min-height: 232px;
}

.keyword {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--size, 13px);
  line-height: 1.2;
}

.table-panel {
  padding-bottom: 0;
  margin-bottom: 14px;
}

.table-wrap {
  overflow: auto;
  margin: 0 -16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  font-size: 14px;
}

th,
td {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

td.num,
td.money {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

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

.source {
  color: var(--muted);
  font-size: 12px;
}

.skill-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.skill-toggle {
  align-self: flex-start;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  background: #eef5f5;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.skill-toggle:hover:not(:disabled) {
  border-color: var(--accent);
  background: #d8ecec;
}

.skill-toggle.is-open {
  border-color: var(--accent);
  background: #d8ecec;
}

.skill-toggle.is-disabled,
.skill-toggle:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.competency-details[hidden] {
  display: none;
}

.vacancy-details {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f9fbfc;
}

.vacancy-details p {
  margin: 0 0 8px;
  font-weight: 700;
}

.vacancy-list + .vacancy-section-title {
  margin-top: 12px;
}

.vacancy-section-title {
  color: var(--text);
  font-size: 13px;
}

.vacancy-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.vacancy-list li {
  display: grid;
  gap: 2px;
}

.vacancy-list a {
  color: #0f3b74;
  text-decoration: none;
  font-weight: 600;
}

.vacancy-list a:hover {
  text-decoration: underline;
}

.vacancy-meta {
  color: var(--muted);
  font-size: 12px;
}

.vacancy-empty {
  color: var(--muted);
}

.status {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: 420px;
  border: 1px solid #f0c36d;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff7df;
  box-shadow: var(--shadow);
}

.panel-state {
  display: grid;
  gap: 10px;
  min-height: 128px;
  align-content: center;
  color: var(--muted);
  font-size: 13px;
}

.panel-state--empty {
  place-items: center;
  text-align: center;
}

.panel-state--loading,
.kpi-skeleton,
.table-skeleton,
.tab-skeleton {
  width: 100%;
}

.skeleton-line {
  display: block;
  width: var(--w, 100%);
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #edf2f5 0%, #f8fafb 46%, #e7eef2 100%);
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.15s ease-in-out infinite;
}

.kpi--loading {
  display: grid;
  align-content: center;
}

.kpi-skeleton {
  display: grid;
  gap: 12px;
}

.kpi-skeleton .skeleton-line:nth-child(1) {
  max-width: 42%;
  height: 12px;
}

.kpi-skeleton .skeleton-line:nth-child(2) {
  max-width: 68%;
  height: 28px;
}

.kpi-skeleton .skeleton-line:nth-child(3) {
  max-width: 52%;
  height: 12px;
}

.tab-skeleton {
  max-width: 520px;
  min-height: 40px;
  align-content: center;
}

.table-skeleton {
  display: block;
}

.table-skeleton .skeleton-line {
  height: 18px;
}

.table-skeleton-row td {
  padding-top: 15px;
  padding-bottom: 15px;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 120% 0;
  }

  100% {
    background-position: -120% 0;
  }
}

.monitor-progress {
  grid-column: 1 / -1;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid #d6e1ea;
  border-radius: 8px;
  background: #edf5fb;
}

.monitor-progress__label {
  margin-bottom: 8px;
  color: #0f3b74;
  font-size: 12px;
  font-weight: 600;
}

.monitor-progress__track {
  position: relative;
  overflow: hidden;
  height: 6px;
  border-radius: 999px;
  background: #d9e4ef;
}

.monitor-progress__bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0d5d74, #1d9baf);
  transition: width 0.25s ease;
}

.monitor-progress--indeterminate .monitor-progress__bar {
  width: 35%;
  animation: monitor-indeterminate 1.2s infinite ease-in-out;
}

@keyframes monitor-indeterminate {
  0% {
    transform: translateX(-15%);
  }

  50% {
    transform: translateX(150%);
  }

  100% {
    transform: translateX(-15%);
  }
}

@media (max-width: 960px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .meta {
    justify-content: flex-start;
  }

  .toolbar,
  .grid-primary,
  .grid-secondary,
  .history-grid {
    grid-template-columns: 1fr;
  }

  .monitor-form {
    grid-template-columns: 1fr;
  }

  .monitor-form__head {
    display: grid;
    gap: 2px;
  }

  .admin-auth,
  .admin-row {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  main {
    padding-left: 10px;
    padding-right: 10px;
  }

  .modal {
    padding: 10px;
  }

  .modal__panel {
    max-height: calc(100vh - 20px);
    padding: 12px;
  }

  .kpis {
    grid-template-columns: 1fr;
  }

  .role-tabs button {
    flex: 1 1 140px;
  }
}
