/* Профиль сотрудника */

.employee-work-form {
  display: grid;
  gap: 18px;
}

/* Информация под именем */
.employee-profile-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 50px;
  margin-bottom: 28px;
  color: var(--text-secondary);
  font-size: 12px;
}

.employee-profile-meta span {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.employee-profile-meta strong {
  color: var(--text);
  font-weight: 600;
}

/* Текстовая информационная таблица */
.employee-info-table {
  display: grid;
}

.employee-info-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(0, 1.3fr);
  gap: 24px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.employee-info-row:first-child {
  border-top: 1px solid var(--line);
}

.employee-info-row > span {
  color: var(--text-secondary);
  font-size: 12px;
}

.employee-info-row > strong {
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.employee-info-note > strong {
  white-space: pre-wrap;
  line-height: 1.5;
}

/* Режим редактирования */
.employee-work-edit {
  display: grid;
  gap: 16px;
}

.employee-work-edit[hidden],
.employee-work-view[hidden],
.employee-absence-actions[hidden] {
  display: none;
}

/* Radio типа оплаты */
.employee-pay-type {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.employee-pay-type legend {
  margin-bottom: 9px;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.employee-pay-type-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.employee-pay-type-options label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  cursor: pointer;
}

.employee-pay-type-options input[type='radio'] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
}

/* Убираем стрелки у ставки */
.employee-rate-input::-webkit-outer-spin-button,
.employee-rate-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.employee-rate-input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Отпуск / больничный */
.employee-absence-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.employee-absence-actions .btn {
  width: 100%;
}

/* Редактирование */
.employee-edit-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.employee-edit-actions .btn {
  width: 100%;
}

/* Кнопка рядом с крестиком */
.employee-profile-edit-button {
  margin-left: auto;
  margin-right: 8px;
  width: auto;
}

/* Сотрудник в отпуске / больничном */
.absence-fixed-employee {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.absence-fixed-employee span {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 600px) {
  .employee-profile-meta {
    display: grid;
    gap: 4px;
  }

  .employee-info-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .employee-absence-actions,
  .employee-edit-actions {
    grid-template-columns: 1fr;
  }
}

/* Расстояние между датой приёма и стажем */
.employee-profile-meta {
  column-gap: 50px;
}

/* Иконка редактирования / сохранения в заголовке */
.employee-profile-edit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 38px;
  padding-inline: 10px;
}

.employee-profile-edit-icon {
  display: block;
  width: 18px;
  height: 18px;
  object-fit: contain;
}

/* Иконки Отпуск / Больничный */
.employee-action-icon {
  display: block;
  width: 17px;
  height: 17px;
  object-fit: contain;
  flex: 0 0 auto;
}

/* Вспомогательная кнопка в шапке модалки */
.modal-aux-button {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  cursor: pointer;
}

.modal-aux-button img,
.modal-aux-button svg {
  width: 18px;
  height: 18px;
  display: block;
}

.employee-profile-edit-button {
  margin-left: auto;
  margin-right: 8px;
}

/* Единый стиль кнопок в шапке модалки */
.modal-header-button,
.modal-aux-button {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  cursor: pointer;
}

.modal-header-button img,
.modal-header-button svg,
.modal-aux-button img,
.modal-aux-button svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* Кнопка закрытия использует тот же стиль, что и вспомогательная */
#modal-root .modal > header [data-close] {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  cursor: pointer;
}

#modal-root .modal > header [data-close]:hover {
  background: var(--surface-soft);
}

#modal-root .modal > header [data-close] svg,
#modal-root .modal > header [data-close] img {
  width: 18px;
  height: 18px;
  display: block;
}

/* Modal close button: borderless */
#modal-root .modal > header button.close-button[data-close] {
  border: 0;
}

/* Действия в карточке сотрудника */
.employee-profile-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.employee-profile-actions.is-editing {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.employee-profile-actions .btn[hidden] {
  display: none;
}

.employee-profile-actions .btn {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.employee-profile-actions .btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Employee profile action icon */
.employee-profile-actions [data-profile-toggle] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.employee-profile-action-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  object-fit: contain;
}

/* Email под именем сотрудника */
.employee-profile-email {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* Hover строки сотрудника */
.people-table-wrap tbody tr.employee-row-clickable {
  cursor: pointer;
}

.people-table-wrap tbody tr.employee-row-clickable > td {
  transition: background-color 0.18s ease;
}

.people-table-wrap tbody tr.employee-row-clickable:hover > td {
  background-color: var(--interactive-highlight);
}

/* Подсветка при навигации клавиатурой */
.people-table-wrap tbody tr.employee-row-clickable:focus-visible > td {
  background-color: var(--interactive-highlight);
}

/* Compact mobile employee cards */
@media (max-width: 767px) {
  .people-mobile-card {
    cursor: pointer;
    padding: 16px 20px;
    transition: background-color 0.18s ease;
  }

  .people-mobile-card:hover,
  .people-mobile-card:focus-visible {
    background-color: var(--nav-hover, #e5eff9);
  }

  .people-mobile-main {
    margin: 0;
  }

  .people-mobile-person {
    min-width: 0;
  }

  .people-mobile-person span {
    display: block;
    overflow-wrap: anywhere;
    color: var(--text);
  }

  .people-mobile-details,
  .people-mobile-edit {
    display: none !important;
  }
}

/* Employee profile dark appearance */
:root[data-theme='dark'] .employee-profile-actions .btn.secondary {
  background: var(--surface-soft);
  border-color: var(--line-strong);
  color: var(--text-strong);
}

:root[data-theme='dark'] .employee-profile-action-icon,
:root[data-theme='dark'] .employee-profile-edit-icon {
  filter: brightness(0) invert(1);
}

:root[data-theme='dark'] .employee-info-row {
  border-bottom-color: var(--line);
}

:root[data-theme='dark'] .employee-info-row:first-child {
  border-top-color: var(--line);
}
