/* Tochkuvannya spreadsheet matrix */
.tochkuvannya-table-wrap {
  overflow-anchor: none;
}

.tochkuvannya-table {
  --tochkuvannya-camper-width: 11rem;
  --tochkuvannya-kind-width: 2rem;
  --tochkuvannya-avg-width: 3rem;
  --tochkuvannya-sticky-bg: var(--sheet-sticky-bg, var(--bg-surface));
  --tochkuvannya-sticky-head-bg: var(--sheet-thead-bg, var(--bg-elevated));
  --tochkuvannya-score-color: #1e40af;
  --tochkuvannya-score-bg: color-mix(in srgb, var(--tochkuvannya-score-color) 7%, var(--bg-surface, #fff));
  --tochkuvannya-score-bg-hover: color-mix(in srgb, var(--tochkuvannya-score-color) 11%, var(--bg-surface, #fff));
  --tochkuvannya-score-bg-focus: color-mix(in srgb, var(--tochkuvannya-score-color) 9%, var(--bg-surface, #fff));
  --tochkuvannya-score-ring: color-mix(in srgb, var(--tochkuvannya-score-color) 42%, transparent);
  width: auto;
  min-width: 100%;
  margin-bottom: 0;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.75rem;
  line-height: 1.15;
}

html[data-theme="dark"] .tochkuvannya-table {
  --tochkuvannya-score-color: #93c5fd;
  --tochkuvannya-score-bg: color-mix(in srgb, var(--tochkuvannya-score-color) 14%, var(--bg-surface));
  --tochkuvannya-score-bg-hover: color-mix(in srgb, var(--tochkuvannya-score-color) 20%, var(--bg-surface));
  --tochkuvannya-score-bg-focus: color-mix(in srgb, var(--tochkuvannya-score-color) 18%, var(--bg-surface));
  --tochkuvannya-score-ring: color-mix(in srgb, var(--tochkuvannya-score-color) 55%, transparent);
}

.table.tochkuvannya-table th,
.table.tochkuvannya-table td {
  padding: 0 0.14rem;
  vertical-align: middle;
  white-space: nowrap;
}

.table.tochkuvannya-table th.tochkuvannya-table__camper {
  padding: 0.1875rem 0.35rem;
  white-space: normal;
  vertical-align: top;
  font-weight: 600;
  overflow: hidden;
}

.table.tochkuvannya-table thead th {
  background: var(--tochkuvannya-sticky-head-bg);
  text-align: center;
}

.tabir-distribution-head-wrap .tochkuvannya-table {
  background: var(--bg-surface);
}

.tabir-distribution-head-wrap .tochkuvannya-table thead th {
  position: static;
  top: auto;
}

.tabir-distribution-head-wrap .tochkuvannya-table thead .tochkuvannya-table__camper {
  position: sticky;
  left: 0;
  z-index: 5;
  background-color: var(--tochkuvannya-sticky-head-bg) !important;
}

.tabir-distribution-head-wrap .tochkuvannya-table thead .tochkuvannya-table__kind {
  position: sticky;
  left: var(--tochkuvannya-camper-width);
  z-index: 3;
  background-color: var(--tochkuvannya-sticky-head-bg) !important;
}

.tabir-distribution-head-wrap .tochkuvannya-table thead th {
  box-shadow: inset 0 -1px 0 var(--border-primary);
}

.tabir-distribution-head-wrap .tochkuvannya-table thead th.tochkuvannya-table__date {
  position: relative;
  z-index: 0;
}

.table.tochkuvannya-table thead th.tochkuvannya-table__date {
  z-index: 1;
}

.tochkuvannya-table-wrap .tochkuvannya-table :is(th, td) {
  border-radius: 0;
}

/* Sticky left columns — widths set here; left offsets derived from widths only */
.tochkuvannya-table__camper {
  position: sticky;
  left: 0;
  z-index: 3;
  width: var(--tochkuvannya-camper-width);
  min-width: var(--tochkuvannya-camper-width);
  max-width: var(--tochkuvannya-camper-width);
  background-color: var(--tochkuvannya-sticky-bg) !important;
  box-shadow:
    1px 0 0 var(--border-primary),
    6px 0 10px -6px color-mix(in srgb, rgb(var(--shadow-key)) 14%, transparent);
}

.tochkuvannya-table thead .tochkuvannya-table__camper {
  z-index: 5;
  background-color: var(--tochkuvannya-sticky-head-bg) !important;
}

.tochkuvannya-table__camper-name {
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.15;
  max-width: 100%;
}

.tochkuvannya-table__kind {
  position: sticky;
  z-index: 1;
  width: var(--tochkuvannya-kind-width);
  min-width: var(--tochkuvannya-kind-width);
  max-width: var(--tochkuvannya-kind-width);
  left: var(--tochkuvannya-camper-width);
  background-color: var(--tochkuvannya-sticky-bg) !important;
  font-weight: 500;
  color: #94a3b8;
  text-align: center;
  box-shadow:
    1px 0 0 var(--border-primary),
    6px 0 10px -6px color-mix(in srgb, rgb(var(--shadow-key)) 14%, transparent);
}

.tochkuvannya-table thead .tochkuvannya-table__kind {
  z-index: 3;
  background-color: var(--tochkuvannya-sticky-head-bg) !important;
}

.tochkuvannya-table__avg {
  width: var(--tochkuvannya-avg-width);
  min-width: var(--tochkuvannya-avg-width);
  max-width: var(--tochkuvannya-avg-width);
  color: #64748b;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.tochkuvannya-table__avg output {
  display: block;
  width: 100%;
}

.tochkuvannya-table thead .tochkuvannya-table__avg {
  background-color: var(--tochkuvannya-sticky-head-bg) !important;
}

.tochkuvannya-grade-select {
  width: 100%;
  font-size: 0.6875rem;
  padding: 0.0625rem 0;
  border: none;
  background: transparent;
  outline: none;
  cursor: pointer;
  line-height: 1.2;
}

.tochkuvannya-table__camper-grade {
  display: block;
  margin-top: 0.2rem;
}

.tochkuvannya-auto-avg {
  display: block;
  font-size: 0.55rem;
  color: #94a3b8;
  line-height: 1.2;
}

.tochkuvannya-table__date {
  width: 3.75rem;
  min-width: 3.75rem;
  max-width: 3.75rem;
  text-align: center;
}

.tochkuvannya-table__date-weekday {
  display: block;
  font-size: 0.625rem;
  text-align: center;
  color: #64748b;
}

.table.tochkuvannya-table .tochkuvannya-table__score-cell {
  padding: 0;
  background: var(--tochkuvannya-score-bg);
  transition: background 120ms ease;
}

.table.tochkuvannya-table .tochkuvannya-table__score-cell:hover {
  background: var(--tochkuvannya-score-bg-hover);
}

.table.tochkuvannya-table .tochkuvannya-table__input {
  width: 100%;
  min-width: 100%;
  height: 1.45rem;
  min-height: 1.45rem;
  padding: 0.0625rem 0.2rem;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  color: var(--tochkuvannya-score-color);
  background: transparent;
  cursor: text;
  transition: background 120ms ease, box-shadow 120ms ease;
}

.table.tochkuvannya-table .tochkuvannya-table__input:focus {
  color: var(--tochkuvannya-score-color);
  background: var(--tochkuvannya-score-bg-focus);
  border-color: transparent;
  box-shadow: inset 0 0 0 1px var(--tochkuvannya-score-ring);
  outline: none;
}

.table.tochkuvannya-table .tochkuvannya-table__input::-webkit-outer-spin-button,
.table.tochkuvannya-table .tochkuvannya-table__input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.table.tochkuvannya-table .tochkuvannya-table__input {
  -moz-appearance: textfield;
}

.tochkuvannya-table__dimension-row:not(.tochkuvannya-table__dimension-row--last) td {
  border-bottom-style: dashed;
}

.tochkuvannya-table__dimension-row--last td {
  border-bottom-width: 2px;
}

.tochkuvannya-table__kind abbr {
  text-decoration: none;
  cursor: default;
  border-bottom: 1px dotted #cbd5e1;
}

.tochkuvannya-table tbody.tochkuvannya-table__attendee:hover {
  --tochkuvannya-sticky-bg: var(--list-row-hover-bg);
}

.tochkuvannya-table tbody.tochkuvannya-table__attendee:hover > tr > th,
.tochkuvannya-table tbody.tochkuvannya-table__attendee:hover > tr > td {
  background-color: var(--list-row-hover-bg);
}

.tochkuvannya-table tbody.tochkuvannya-table__attendee:hover > tr > .tochkuvannya-table__camper,
.tochkuvannya-table tbody.tochkuvannya-table__attendee:hover > tr > .tochkuvannya-table__kind {
  background-color: var(--tochkuvannya-sticky-bg) !important;
}

@media (max-width: 767.98px) {
  .tochkuvannya-table {
    --tochkuvannya-camper-width: 7.25rem;
    --tochkuvannya-avg-width: 2.75rem;
  }

  .tochkuvannya-table__camper {
    font-size: 0.75rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
    line-height: 1.15;
  }

  .tochkuvannya-auto-avg {
    display: none;
  }

  .tochkuvannya-grade-select {
    font-size: 0.625rem;
  }
}
